| Author |
Java swing application not repainting
|
Braden Steffaniak
Greenhorn
Joined: Jun 03, 2011
Posts: 15
|
|
I have a java application that should be repainting all the time, however, only repaints once.
heres the method that runs continuously through a infinite loop:
And heres the paintComponent method:
It only prints "testing" once... then never again. On the other hand, it prints "asdf" continuously. What am I doing wrong?
|
 |
Rob Camick
Ranch Hand
Joined: Jun 13, 2009
Posts: 1808
|
|
We can't tell what you are doing wrong based on a few lines of code because we don't know the context of how/when the code is executed.
Maybe your loop is running on the Event Dispatch Thread and you are preventing the frame from repainting itself since the repaint will only be done when the loop is finished executing.
Use a Swing Timer to schedule animation/repainting.
Post your SSCCE that demonstrates the problem.
|
 |
 |
|
|
subject: Java swing application not repainting
|
|
|