2,777 Posted Topics
Re: Can you describe the steps the code should take to solve the problem? What is the program supposed to do? | |
Re: Try debugging the code by adding println statements that print out the values of all the variables as they are used. The print out will help you see what the problem is. | |
Re: How do you want to display the file's content? One easy way would be to put the lines from the file into a JTextArea. I don't see any GUI code in your post. You have a lot to read about then: [Click Here](http://docs.oracle.com/javase/tutorial/uiswing/index.html) | |
Re: > I now how to set the icons, but now I am absolutely confounded as to how I move the icon from one jbutton to the nu=ext as a way of movement. I want to be able to do this by use of a set of mouse clicks. Have you … | |
Re: To solve your problem you need to consider: How do the lines in the file relate to the rows in the array? How do the characters in a line relate to the columns in the array? | |
Re: I don't think that the Java language has macros. Can you define what you mean by a macro? My definition is a source construct that generates different code base on parameters passed to the macro. What you are asking about sounds like recording of a script that can be played … | |
Re: [QUOTE] to make it send the average to all clients[/QUOTE] Save the connections to all the clients so you can send more messages to them. One thing you could do would be to start a Thread to handle the connection when the accept returns a socket for that connection. Have … | |
Re: The more bits you change the more the original source will be changed allowing possible detection of the change. | |
Re: > how to get the persons name When you read in a line from the names file, you need to split the line into parts at the ;. The name looks like it is the first part of the line. Look at the String class's split method to do the … | |
Re: **new **may be confusing the compiler to look for a constructor. | |
Re: You should read the JFrame API doc about the method you are using. It is not one of the methods that has been overridden As a conveniance. Then Call repaint() to have the GUI redrawn. | |
Re: A class can have some methods with code that can be executed, an interface does not have any code. | |
Re: > Exception in thread "main" java.lang.NullPointerException > at Main.GetAllAdjcentNodes(Main.java:69) Look at line 69 and find what variable has a null value. Then back track in the code to find out why that variable does not have a valid non-null value. | |
Re: You need to add a loop to keep the game going until the end of the game. | |
Re: One way is to have accessor (get/set) methods in the class that owns the arraylist. If you are going to populate it in another method, have that method create it, populate it and return it. | |
Re: The variable: rand only exists when there is a instance of the Pickrand class. It is not defined as static. The code is trying to access it without first creating an instance of the class and of the variable. If it were static you would not need an instance of … | |
Re: > how to put the words into "families" What is a "family" of words? | |
Re: If you put the input to the method in an array, then you will be able to pass any any sized array you want to the method. If you pass the values separately then the number of parameters to the method is set when you define the method. If you … | |
Re: You are probably having a problem with the Scanner class. Scanner methods can be tricky. The Scanner buffers input and can block waiting for input. For example if you enter: A word to the wise <PRESS ENTER> and use next() only "A" is read, and "word to the wise" is … | |
Re: What timing of the printlns are you trying to achieve? Each thread is independent of the other. If you want them to coordinate when they print, you will have to change the code so that when one prints it starts the other one to do its wait. And so forth. | |
![]() | Re: "this" is a reference to the object that the code is executing in. In a method where the local variables passed as parameters have the same name as class variables, you use this to get access to the class variables. If the names are different,. you do not need to … |
![]() | Re: What is "the rest" that you are trying to do? ![]() |
Re: The = operator sets the variable on the left of it to the value on the right. | |
Re: > I keep getting an error Please post the full text of the error message. | |
Re: Have you tried debugging by printing out the values that are used to see what the code is doing? For example print out what the nextDouble method returns and what the randValue is. | |
Re: Add a println to show what is being compared so you can see what the computer is seeing. | |
Re: Read it into a String. | |
Re: When the java command executes a class,it calls the class's main() method which is responsibe for starting the execution of the rest of the class. You main() metjhod is empty. You need to add some code to it that will call the methods to create the GUI and start things … | |
Re: If those are the only ones you want to print, then you don't need a loop. Using two println statements will work fine. The items to be printed don't look right. You should be using the name of your array, not Arrays.toString | |
Re: What specific java coding questions do you have? Can you post the code and ask your questions? | |
Re: It is not possible to change the size of an array. I recommend that you use an aray list if you don't know what the size is to be. Otherwise, define a new array with the desired size and copy the contents of the old array to it (see Arrays … | |
Re: Cross posted at [Click Here](http://www.java-forums.org/new-java/58958-username-password-cliet.html#post282643) | |
Re: > I am getting caught up in private and public classes and methods... Please explain what your problems are and post the error messages you are getting. > am getting crazy numbers for a height. Please post the output from the program. Have you tried debugging the code? Add lots … | |
Re: Go through the code and find the matching } for every {. Some editors will do this when you position the cursor on a { and press a key combo: Ctrl+] on mine) the editor wll move the cursor to the pairing } Otherwise print the listing on paper and … | |
Re: What are the results when you execute the code? Post the full text of the error messages here. | |
Re: > does not place a decimal in the geoPoint. Please explain and give an example. | |
Re: Look in the browser's java console for any error messages. You should call the printStackTrace() method in the catch block to get better error messages. | |
Re: Please post the full text of the error message. Be sure to call the printStackTrace() method in the catch block to get the full text of the error message. | |
Re: > I tried getSelectedValues().toString(); but it didn't work What was returned? What was wong wiith it? | |
![]() | Re: You will have to write a loop to get each element from the list one by one so you can print its value with its position in the list. |
Re: Write down on paper the indexes for the elements that you are to print. Then look at the difference between each of the indexes. Look at the definition of the for statement. What does the for statement's third expression/clause do? | |
Re: Please post the full text of the error message and a complete source a program that compiles, executes and shows the problem. | |
Re: > Is there an easier way to go about this? Probably not. | |
Re: Please post the full text of the error message. What line in the code has the error? | |
![]() | Re: What is the range of the values of the numbers? For example: 10 to 9999999? How many numbers do you need? That will determine ways to get a list of unique random numbers. ![]() |
Re: You probably need the jar file that contains the classes in the package you are trying to import. When you get it, you'll have to put it on the classpath so the compiler can find it. Try Googling for the where you can download the jar file | |
Re: Instead of overriding the frame's paint method, you should create a class that extends JPanel and override its paintComponent method |
The End.