painting syncronized, spin increments in units, not loops of the thread
authoramwaterhouse <Andrew Waterhouse>
Mon, 18 Apr 2005 16:05:30 +0000 (16:05 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 18 Apr 2005 16:05:30 +0000 (16:05 +0000)
src/jalview/gui/WebserviceInfo.java

index 63a289f..26aa067 100755 (executable)
@@ -88,15 +88,21 @@ public class WebserviceInfo extends GWebserviceInfo
 \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
@@ -105,7 +111,7 @@ public class WebserviceInfo extends GWebserviceInfo
 \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