Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Jpanel and repaint() problem

Hi,

I am trying to code a simple alarm clock, and I'm having problems with the repaint() method.

The applet has been setup using a JPanel, and as the seconds pass by, I want the digital clock to update this. In the run() method I call for the repaint() hoping that it will clear the screen and update it with the new time.

What actually happens is the new time updates itself and paints on the old time :(

can someone pls help me with this. I've written the same code without using a Jpanel, but using normal frames and it works. :confused:

anyone got any ideas??
[622 byte] By [Audette] at [2007-11-11 8:35:08]
# 1 Re: Jpanel and repaint() problem
So the new time is being painted on top of the old time, so they're overlaying? You have to clear the area yourself first. You'll probably get some flickering though, so look into double buffering.
Phaelax at 2007-11-11 22:35:01 >
# 2 Re: Jpanel and repaint() problem
I'l try working on your problem. Plz visit the forum again. Maybe i can fix it.. :)
blessonjs at 2007-11-11 22:36:01 >