2,777 Posted Topics
Re: A way: First you need a JFrame to present a window. A JPanel to draw the board on. Override the paintComponent class and do the drawing there A JPanel to display status such as whose move and winner or draw notifications. A switch for player to ask to play as … | |
| |
Re: To help figure this out, you could have added some println() statements to show how the values of your variables change: [CODE]or (int x = 1; x<=3; x+=1) { tempStringB = tempStringB + x + " "; System.out.println("tempB=" + tempStringB); // show new B } for(int i = 0; i … | |
Re: [QUOTE]i tried the following:[/QUOTE] And did it work? | |
Re: [QUOTE]i want it to draw, increment draw increment [/QUOTE] It looks like the loop in the paintComponent() does what you want. It does a page.fillRect() and then increments start and then does a page.fillRect() and then increments for values.length times. What do you want to change? | |
Re: Your posted code is missing the import statements needed to compile it. If there are any packages outside of the standard java packages, they'd be needed also. | |
Re: Doesn't look like a java programming question. Have you tried asking it on a forum for the appropriate topic. | |
Re: It seems like the scrollpane should work. Have you tried to use it yet? | |
Re: There are several classes for dealing with dates. Date and Calendar for example. If the times are as simple as your example, then take the minutes divide by 60 and add to the hours. | |
Re: [QUOTE]java.io.FileNotFoundException[/QUOTE] I think is says that The program can't find the file/path to the file. Add a println() to show the value of location before the Constructor call to File(). | |
Re: Can you post the code? There are two modes of writing to a file: replace or append to it. | |
Re: I copied your code, compiled and executed it without problems on a WinXP system with java 1.6.0-10 | |
Re: I found some code via Google years ago. It has lots of special code depending on what OS your executing on. I have no idea if the code will work on Linux or Mac today. I am currently using it in my WinXP apps. | |
Re: [QUOTE]my Java program doesn't output anything[/QUOTE] no error messages? | |
Re: Can you post the full text of the error message? And the lines in your program referred to in the error message. | |
Re: Please post full text of error message here. It makes it a lot faster and can have more and correct info about the problem. Read the API doc for the method you are using. What does it return? | |
Re: Does your IDE have a Search? Try looking for where there is definition of a JFrame. Does the main class extend JFrame? | |
Re: Try Google. Or any other search. | |
Re: You can't reference a non static class variable from a static method. The class varible only exists in created objects (ie with new). Why does the code want to see a variable belonging to an object when there is no object? If the variable is static then there is only … | |
Re: It's not an error. Its a warning to the user that the code being executed could be dangerous. Why do you need to sign the applet? What does it do that requires permission? Just tried your applet and got following error message in Java console: java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0) … | |
Re: You've got a long way to go. Write code to read in and save the dictionary file which I assume is given for you to be able to check there is such a word. Define and code a Player class. Then for each item in the list, think what the … | |
Re: Your code does not compile without errors. StackOverflow_Main.java(34,31) : error J0049: Undefined name 'JComponent' StackOverflow_Main.java(44,23) : error J0049: Undefined name 'Graphics' 2 error(s) Add some debugging code: put the code in the main() method in a try{...}catch(Error e) {e.printStackTrace(); ) block and examine the call stack trace. | |
Re: What doesn't work about the code? What value does it return in error? I don't see any debug code to help you see how the algorithm is working. Try adding some println() to see what the code is doing. | |
Re: Try debugging your code to see what it is doing and why. Add lots of println() statements to follow logic flow and see how variables change. | |
Re: Your comparing a double with an int. Not often equal. Write a small test program to see what happens when comparing double with int. Or add a println() of grade before testing if it == -1 Include the boolean expression: (grade == -1) in the println() to see if its … | |
Re: If you are saving the values in an array, look in the array before adding a new one to be sure that it is not already there. | |
Re: Please show full text of error message here. |
The End.