The code you posted has to be rewritten.
Type: Posts; User: Norm
The code you posted has to be rewritten.
Make a SSCCE to show the problem.
You will probably need separate panels for the buttons and the drawing area.
Good luck rewriting the code.
Try to use Swing classes instead of the older AWT classes you are using.
You should be able to see how drawing works now. You'll have to rewrite your code.
I don't see it in post#23. Where is it? I do NOT find it when I search the posted text.
Where did you do this:
set the size of the MovePingPong frame and make it visible.
I made the changes I suggested in post #20 and added this one extra line to the new paint method:
b.DrawCircle(g);
This causes a circle to move around in the MovePingPong frame.
No. I don't see an override of the paint method in that class.
The JFrame that MovePingPong extends is never set visible nor does it have any components added to it.
Add a paint method to...
A bit of rewriting. Use the timer to call you code that sets the new/next position of the shape, calls repaint and exits. In the paint method draw the shape at the new location.
Next timer call to...
You do not override any paint methods. That is the method that the JVM will can after you call repaint.
I've never seen your technique for animation. There are dozens of code samples on the forum...
Can you make ONE source that compiles and executes and shows the problem. You have posted at least 4 so far. One source that shows the problem would be bettter.
The code you just posted does not compile. I get these errors:
TestMenu.java:12: cannot find symbol
symbol : class Picture
location: class TestMenu
private static Picture pic;
...
Please make a small simple program (SSCCE) that compiles, executes and shows your problem.
Please Edit your post and wrap your code with
<YOUR CODE HERE>
to get highlighting and preserve...
Please make a small simple program (SSCCE) that compiles, executes and shows your problem.
Please Edit your post and wrap your code with
<YOUR CODE HERE>
to get highlighting and preserve...
The first thing I see is two classes that extend Frame.
What are the two frames for?
The code does not compile. Several classes are missing. Impossible to test unless the code compiles and...
I am assuming that you have listeners for the buttons.
If your code does not use listeners, then I have no idea how it is working.
Can you post your code so we can see how it works?
Basically you need to return/exit from your listener method code after you call repaint.
Here are links with some of the terms defined:...
Does the method that calls repaint() return control to the JVM so that it can call the paint method?
If your code is using the JVM's GUI/EDT thread like in a listener, the JVM will queue the calls...