2,777 Posted Topics
Re: > how to add point of "Point" type Define an instance of a Point class object and pass it to the add() method: Point aPt = new Point(); points.add(aPt); | |
Re: Please explain what you need a second loop for. What is the code supposed to do? What does it do now? One problem with your code is that it is not properly formatted. You should always use {}s with loops and if statement to contain the code within those statements. … | |
Re: Can you post the output from the code? One problem I see is there is no ending }s for the two {s | |
Re: Please post the full text of the compiler's error message. | |
Re: What controls the "miss" being shown? | |
Re: Where are you having problems with your code? Post the code and ask your questions. | |
Re: What kind of an array? The String class has a method that will create an array from a String. Or create the array and use another String class method to get the characters one by one and store them into the array. BTW array indexes start at 0. L's index … | |
Re: It is more usefull to see and work with a hexidecimal display of the RGB values instead of a decimal display. You will have to break the value 2000000 into its R G and B components so you can use them with the setRGB() method. > define the color for … | |
Re: Please post the full text of the error messages. Post the program's current out put and add comments to show what is wrong with it and show what you want it to look like, | |
Re: Can you explain what you are trying to do? Most monitors are vertical to the plane where there would be a 360 degree view where North could be pointed to. My monitor faces East, the right hand is to the North and the left to the South. A GPS device … | |
Re: The code works for me as is. | |
Re: You should use the equals() method to compare Strings. Your if test using == compares two variables to see it they both refer to the same object. You want to get the contents of those objects as Strings and compare them. | |
Re: Are you trying to write the program and have questions about how to do it or what are you looking for? | |
Re: > Error: The local variable word may not have been initialized Give the variable: word a value when you define it. | |
Re: Is this your assignment? What have you done so far? Do you have any specific questions? | |
Re: What happens when you compile and execute the code? | |
Re: Check that all the {}s are properly paired. | |
![]() | Re: > variable letterGrade might not have been initialized" The compiler sees that there is a variable: letterGrade being used in the code that may not have been given an initial value. There is not an ending else clause following the chain of if/else if statements to guarantee the variable gets … |
Re: > what to do next. Can you explain? Does the program work the way you want? | |
Re: Try debugging the code by adding lots of println statements to the code that show the values of variables as they are used and as they are changed and to show the program execution flow so you can see what the computer sees and understand what your program is doing. | |
Re: Also the if statement requires a boolean expression inside of the ()s; A method defined as void does not return a boolean value. | |
Re: Try some testing. Load the same image in the new ImageIcon() calls and see if there is a problem with the java code vs the images. | |
Re: Are you asking about the location of a window on the monitor? There are methods for setting the location. | |
Re: Where are you going to draw the tree? Is this a console window or in a GUI? What class is the drawRectangle() method in? | |
Re: Are you asking if the source code for a program can be changed while the program is executing? The number of nested loops would be specified in the source before it is compiled. What problem are you trying to solve? | |
Re: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Courier New;}} {\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\f0\fs20 This is RTF\par } > if I open the document and add some text manually and save the file What program are you using? Open the file in another program like Notepad and see what it contains before and then after you add the … | |
Re: Do you have a small input file for testing? How did you code the hashCode method so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes? | |
Re: Does it compile and execute? Is the output correct? That would be a way to see if it is correct. | |
Re: You will have to draw all the lines every time. Save the coordinates for the lines in a list and go through the list and draw the lines every time in the paint method. You should call the show_line() method from the paintComponent() method passing it the Graphics object. Or … | |
Re: Where do you add any buttons to the GUI container object? | |
Re: > choose a button that is not currently marked When you chose a button, test if it is marked (how are you marking the buttons) and if it is marked, chose another one. > how to randomly shuffle over elements in button array Use the Random class to chose the … | |
Re: Read the API doc for the FileOutputStream class. Its constructor has an arg for appending to the file. | |
Re: > it just comes up with an exception error Please post the full text of the error message. | |
Re: What have you tried so far? Do you have any specific questions or problems? Please post them. | |
Re: Where is the paint() method? In a Swing app, you would call the repaint() method to request the jvm to call the paint method at some time a little later. | |
Re: It depends on what you mean by validation. Correctly formatted email address. A name (no digits) A number(no letters) | |
Re: How many years do you plan to take for the fantastic project? | |
Re: > how can I make the ''not found'' message print only once If you onlly want one message printed after the search ends, use a boolean variable (init to false) to record if a match is found(set to true). After the end of the loop if the boolean has not … | |
Re: Why do you think it is a class? Is it in a package that needs to be imported? | |
Re: Does your code compile and execute without error? What does it print out when it executes? Post its output and Add some comments to the post saying what is wrong with the output. If you get errors, copy and paste the full text of the error messages. | |
Re: The array: array contains only Test2 objects. It does not contain either int or String objects. You must ask the Test2 object what it contains. Add methods to the Test2 class that will check for the contents that you want to test for. Then you can call those methods to … | |
Re: Your unformatted code is very hard to read and understand. Can you post code that is properly formatted? | |
![]() | Re: Can you explain what you want to copy? Is it the image that is displayed on the screen? Use the Robot class to capture the screen and then write it to a disk file. What do you mean by "copies of the same applet"? Are you talking about java classes … ![]() |
Re: The JVM is probably moving the focus to where it wants it. What component has focus when the app starts? When does the code call requestFocus()? That method is not recommended any more (see the API doc). It recommends you use another method: requestFocusInWindow | |
Re: Please edit your post and properly align the code. The nesting of statements within {} should be indented 3-4 spaces. The posted code is not readable with all the statements starting in the first column. Can you explain what problems you are having with the code? Post the full text … | |
Re: Try debugging the code by adding some println statements that show where the code is executing and the values of the variables as they change and are used. The output will show what the computer is seeing and what the code is doing. | |
Re: The filename of the .java file should be the same as the name of the public class it contains. You need to add a println that shows what number is being tested as well as the results of the test. | |
Re: If you are getting errors, You forgot to post the full text of the error messages. | |
Re: There are two steps in using an array of objects. The first one defines the array. Your code does that. The second step is assigning an instance of an object to each element of the array. Your code does NOT do that. For example: call[0] = client; // assign an … |
The End.