kirk.gui.closer
Class GLWindowCloser

java.lang.Object
  extended byjava.awt.event.WindowAdapter
      extended bykirk.gui.closer.WindowCloser
          extended bykirk.gui.closer.GLWindowCloser
All Implemented Interfaces:
EventListener, WindowFocusListener, WindowListener, WindowStateListener

public class GLWindowCloser
extends WindowCloser

This class closes Windows that generate WindowEvents asking for it. If specified, it can also end the program after the closing of a Window. This is useful for main Windows. This class is special, because it is specially made for Windows having a GLCanvas or GLAnimCanvas on it. These need to have cvsDispose() called before the Window closes. These classes are from the GL4Java OpenGL binding. For more control I recommend using the Finisher interface. That way you can have key events close the program too (just have it call finish()).

Version:
1
Author:
Berend "Kirk" Wouda

Field Summary
protected  gl4java.awt.GLCanvas glcanvas
          The GLCanvas that needs a dispose before the window it is in is disposed.
 
Fields inherited from class kirk.gui.closer.WindowCloser
 
Constructor Summary
GLWindowCloser(gl4java.awt.GLCanvas glcanvas)
          Constructs a new GLWindowCloser with the given GLCanvas.
GLWindowCloser(gl4java.awt.GLCanvas glcanvas, boolean exit)
          Constructs a new GLWindowCloser with the exit option, and the given GLCanvas.
 
Method Summary
 void windowClosing(WindowEvent event)
          Closes the Window, and disposes the resources used by the GLCanvas.
 
Methods inherited from class java.awt.event.WindowAdapter
windowActivated, windowClosed, windowDeactivated, windowDeiconified, windowGainedFocus, windowIconified, windowLostFocus, windowOpened, windowStateChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

glcanvas

protected gl4java.awt.GLCanvas glcanvas
The GLCanvas that needs a dispose before the window it is in is disposed.

Constructor Detail

GLWindowCloser

public GLWindowCloser(gl4java.awt.GLCanvas glcanvas,
                      boolean exit)
Constructs a new GLWindowCloser with the exit option, and the given GLCanvas.

Parameters:
glcanvas - The GLCanvas to dispose before the window it is in is disposed.
exit - true if the program should exit after closing a window, false otherwise.

GLWindowCloser

public GLWindowCloser(gl4java.awt.GLCanvas glcanvas)
Constructs a new GLWindowCloser with the given GLCanvas. It will not end the program on close.

Parameters:
glcanvas - The GLCanvas to dispose before the window it is in is disposed.
Method Detail

windowClosing

public void windowClosing(WindowEvent event)
Closes the Window, and disposes the resources used by the GLCanvas.

Specified by:
windowClosing in interface WindowListener
Overrides:
windowClosing in class WindowCloser
Parameters:
event - The event that indicates which Window to close.