2,777 Posted Topics
Re: Find a definition for the algorithm you are supposed to use and study it. | |
![]() | Re: Please post the full text of the error message. It shows which line the error occured on. Or if you know the line number, look at that line and find what variable has the null value and then backtrack in the code to see why that variable does not have … ![]() |
Re: Use the jdb reference to an instance of the Calculator class to call the calculate() method. The code is ignoring the value returned by the method??? | |
Re: For some examples look at the API doc for java.util.List (an interface) and then at a class that implements it: ArrayList | |
Re: If the data you want is contained in varaibles in the dialog box class, you need to add methods to that class that you can call to get the data. Can you post the code you are having problems with. | |
Re: > How to know which jList is selected Each JList can have a selected item in it. What do you mean by "JList is selected"? They all can have a selected item. Have you looked at the API doc for the JList class? It has lots of methods that could … | |
Re: One thing that could help you see what the code is doing: Print out the contents of the array before the call to the method and after the call. | |
![]() | Re: > how can I stop generating numbers when I hit the target number Where do you get the numbers? When you get the target number, stop asking for any more numbers. Either exit the loop or return from the method when the target number is hit. Your code has too … ![]() |
Re: Are you talking about Strings in those formats? Like "111" as binary would have an int value of 7 I don't think there is a method to convert a String in one format to a String in another format. You will probably have to combine some methods to do that. | |
Re: To format the numbers like you want you can use the DecimalFormat class. It has lots of formatting characters to generate many different formats. For the date, see the SimpleDateFormat class. It also has many formatting options. Find the API docs for these classes at: [Link Anchor Text](http://docs.oracle.com/javase/6/docs/api/index.html) | |
Re: Can you explain your problem? I see a definition for the MyDate class in your post. | |
Re: Can you explain what your problem is? What happens when you execute the program? If there are errors, please post the full text of the error messages. | |
Re: That is true. You can not convert a double to an array of doubles. You must change one or the other so that they are both the same type: double or double[] Please post the full text of the error message. Your editted version leaves off information. | |
Re: In the MainFrame class call a method in the LoginForm class that returns the contents of jTextField1 and use thst to set the text of jLabel1. Or have the button listener in the LoginFormm class get the value from the text field and call a method in the MainFrame class … | |
Re: Can you explain what the problem is? Do you have the algorithm for the sort and are having trouble writing the code for the algorithm or do you need an algorithm? | |
Re: The compiler has found some potential problems in your code and recommends that you use the -Xlint option of the javac command to see the full text of the warning/error messages. Add the -Xlint option to the compiler's options and recompile the program. | |
Re: You can put more than one class definition into a java source file. Only one can be public at the root level. Also you can define classes inside of other classes. There are utility classes: Arrays and Collections that have a sort method you can use if you properly define … | |
Re: Do you have a question? | |
Re: What is the criteria used to place the items in the tree? What kind of tree? | |
Re: The Graphics class has a setFont method. Call it with the required font size before drawing the String that you want at that font size. For the String: "83." and the String "50" and the String "7" | |
Re: The JOPtionPane class has methods that will display a message in a window | |
Re: > it didn't work... Post the full text of the error message and the code that is causing the error. | |
Re: Sounds like AI stuff. Most of your problem will be design. When you get a design then we can help you with the java coding part. Good luck. | |
Re: >java.lang.ClassNotFoundException: com.scand.jtree.TreeApplet.class The error message says that the JVM can not find a class named: com.scand.jtree.TreeApplet**.class** This looks like a filename (has the .class extension) not a class name. Remove the .class to make it a class name. | |
Re: How did you try to debug it? I don't see many printlns statements to show the changes in the variables and the execution flow. You need to print out everything so you can see what the computer sees. If you understand how the code is supposed to work, when you … | |
Re: Can you post the code that you are having problems with. Pseudo code: begin loop get next record process record possibly causing an exception handle exception end loop | |
Re: I'd use a Thread to move processing off of the EDT's thread for one example. Another use would be when you want to be able to get data from a file or the internet and at the same time have a responsive GUI that the user can interact with. Another … | |
Re: Take a look at these pages: [Link Anchor Text](http://docs.oracle.com/javase/tutorial/java/javaOO/classes.html | |
Re: What compiler errors do you get when you try to compile the program? Try using the javac command to compile the program and see what error messages it gives. | |
Re: >how do I find out exactly how long it took Get the starting time and save it in a long variable. When done, get the current time and subtract from it the starting time to get how long it took. | |
Re: Can you post the output from the progam that shows what is does? Your recursive call can be a problem. What will be the values of the variable that is returned by the method when the recursive call returns? Add a println in the catch block to print out its … | |
Re: The code is missing class definitions and will not compile. | |
Re: Have you tried writing a small simple program with a String for testing with the split() method? That would allow you to experiment to see how it works. The Arrays class's toString() method is useful for formatting arrays for printing: print this: Arrays.toString(<THEARRAYNAMEHERE>) Try split() with some sample Strings, print … | |
Re: If you can paste a String and the text from a file is a String, why can't you paste the String read from a .txt file to the clipboard? | |
| |
Re: > determine whether or not a path turns or ends up in a dead-end, By checking the adjacent pixels to see if the clear path continues or if it ends. | |
Re: Take a piece of grid paper and draw out the first set of rectangles and look at the relationship between the x,y for the large rectangle and the smaller ones at each corner. Then draw the next set and do the same to find the formula for computing the x,y … | |
Re: If the user is to enter the name of the month, you will have to read a String as input from the user. > create a string array and search the list for the position in the array. Your idea about the String array sounds ok. Where is the problem … | |
Re: Quoted > I have a problem with this program Please explain what the problem is. If you get errors, please copy the message and post it here. | |
Re: Are you looking for a different formatting and contents for the program's output? Instead of this: momPalindrometrue you want this: Mom is a palindrome Where is the current output generated? Find where the current output comes from and change it to output what you want to see. | |
Re: Have you read the API doc for the classes and methods that the code uses? Did you have questions about what the doc says? | |
Re: > what is wrong with this? Can you post the console from when the code is executed and add some coments to it that explains what the problem is? | |
Re: > what could be causing this? The method is calling itself too many times. When do you expect that it will stop calling itself? Try debugging the code by adding some println statements to show the values of the variables used so you can see what the computer sees when … | |
Re: What does the "display" have to do with the execution of threads? | |
Re: A double is a numeric value that doesn't a a "look" until you format it. How it "looks" depends on how you format it for viewing. The DecimalFormat class is one way to format a number for viewing. Are you comparing numeric values or Strings? | |
Re: The updating of GUI is done on the same execution thread that was used to call your listener method. It will not do any updating until the listener method returns usage of the thread. All the changes you make on the thread are not made visible until the JVM gets … | |
Re: > Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at AKDatabase.CSubmitActionPerformed(AKDatabase.java:193) Look at line 193 and see what variables are used on that line. find the one with the null value. You could print out the values of all the variables used there to see which one is null. Then backtrack in the … | |
Re: The BufferedImage class has a method that returns an array of pixels that can be scanned. I do not know of any class or method that will scan that array for what you wan to find. | |
Re: Where is the button array used on line 34 given values for its elements? Think about the scope of variable definitions and if you have more than one variable defined with the same name. If you use unique names for all your variabes (except for loop variables like i and … | |
Re: To connect two programs through sockets, one needs to use a ServerSocket and the other a Socket. The ServerSocket's accept method will receive a connection from the other program's Socket object. |
The End.