| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
|
cool! :-) On my pc, it works better with the following modifications. The goal is to have a constant angular speed. Also maybe you can use a SwingTimer instead of a thread ? I read somewhere it's not safe to call awt/swing API outside the main thead, but maybe it's ok for repaint(). thanks! public void run(){ long t0 = System.currentTimeMillis(); // while(true){ long t1 = System.currentTimeMillis(); // angle += deltaAngle * (float)(t1-t0); // constant speed t0 = t1; if(((angle >= endAngle-deltaAngle/2) && (deltaAngle > 0)) || ((angle <= endAngle-deltaAngle/2) && (deltaAngle < 0))){ angle = endAngle; if(Math.abs(angle - 360) < deltaAngle / 2) angle = 0; if(Math.abs(angle - 180) < deltaAngle / 2) angle = 180; repaint(); break; } if(angle >= 360) angle = 0; if((int)angle % 90 == 0){ angle += deltaAngle; } try{ Thread.sleep(1000/30); // 30 FPS repaint(); getToolkit().sync(); }catch(Throwable tt){ } } Dmitry Markman wrote: applet is available too |
begin:vcard fn:Arnaud Masson n:Masson;Arnaud org:KIKA Medical;R&D adr:;;;Nancy;;54000;France email;internet:email@hidden x-mozilla-html:TRUE url:http://www.kikamedical.com version:2.1 end:vcard
_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden This email sent to email@hidden
| References: | |
| >Dashboard effect in Java application (From: Dmitry Markman <email@hidden>) | |
| >Re: Dashboard effect in Java application (From: Dmitry Markman <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.