\r
class AnimatedPanel extends JPanel implements Runnable\r
{\r
+ long startTime=0;\r
public void run()\r
{\r
+ startTime = System.currentTimeMillis();\r
while(currentStatus<STATE_STOPPED_OK)\r
try\r
{\r
- Thread.sleep(10);\r
- angle += 1;\r
+ Thread.sleep(50);\r
+\r
+ int units = (int)((System.currentTimeMillis()-startTime)/10f);\r
+ angle += units;\r
angle %= 360;\r
+ startTime = System.currentTimeMillis();\r
repaint();\r
+\r
}\r
catch (Exception ex)\r
{}\r
\r
}\r
\r
- public void paintComponent(Graphics g1)\r
+ synchronized public void paintComponent(Graphics g1)\r
{\r
Graphics2D g = (Graphics2D) g1;\r
g.setColor(Color.white);\r