summaryrefslogtreecommitdiffstats
path: root/src/demos/gears
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos/gears')
-rw-r--r--src/demos/gears/Gears.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java
index 0260ccb..94d563d 100644
--- a/src/demos/gears/Gears.java
+++ b/src/demos/gears/Gears.java
@@ -28,8 +28,15 @@ public class Gears {
final Animator animator = new Animator(canvas);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
- animator.stop();
- System.exit(0);
+ // Run this on another thread than the AWT event queue to
+ // make sure the call to Animator.stop() completes before
+ // exiting
+ new Thread(new Runnable() {
+ public void run() {
+ animator.stop();
+ System.exit(0);
+ }
+ }).start();
}
});
frame.show();