View Single Post
  #2 (permalink)  
Old 07-03-2008, 09:43 PM
Norm's Avatar
Norm Norm is offline
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,223
Norm is on a distinguished road
Suggestions:
Use CODE tags around code that you post to make for easier reading.
Use words for variable names instead of single letters
Naming conventions for Java classes is Uppercase first letter.

Re your logic - Following probably wrong because it is hard to read your code without the indentation showing nesting of {}.
Move the loop out of the paintComponent() method. You should only stay in this method long enough to do some drawing and then exit. Use repaint() to cause the system to call the paintComponent() method. Put the repaint() call following where you compute what/where to draw, probably in a loop inside a thread .

There are several examples of how to use Threads. Use a Search to find some and then put some code in your progam and post it using CODE tags.
Reply With Quote