diff options
Diffstat (limited to 'src/demos/cg/runtime_ogl_vertex_fragment')
-rw-r--r-- | src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java index 38ab297..3ceabc0 100644 --- a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java +++ b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java @@ -74,12 +74,18 @@ public class runtime_ogl_vertex_fragment implements GLEventListener frame.setSize(512, 512); final Animator animator = new Animator(canvas); frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - animator.stop(); - System.out.println("Exiting"); - System.exit(0); - } - }); + public void windowClosing(WindowEvent e) { + // 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(); animator.start(); |