public void run() {
// Create the OpenGL rendering canvas
GLCanvas canvas = new GfrGLCanvasPlgViewerVolShps3dAni();
// Create a animator that drives canvas' display() at the specified FPS.
final FPSAnimator animator = new GfrFPSAnimatorPlgViewerVolShps3dAni(canvas);
// Create the top-level container
ifr.getContentPane().add(canvas);
ifr.addInternalFrameListener(new InternalFrameAdapter()
{
@Override
public void internalFrameClosing(InternalFrameEvent e)
{
// Use a dedicate thread to run the stop() to ensure that the
// animator stops before program exits.
new Thread()
{
@Override
public void run()
{
try
{
if (animator.isStarted()) animator.stop();
}
catch(Exception exc) // ie. java.lang.Exception: Stack trace,
{
// don't care
}
}
}.start();
}
});
animator.start(); // start the animation loop
}
});