kirk.gui.closer
Class GLWindowCloser
java.lang.Object
java.awt.event.WindowAdapter
kirk.gui.closer.WindowCloser
kirk.gui.closer.GLWindowCloser
- All Implemented Interfaces:
- EventListener, WindowFocusListener, WindowListener, WindowStateListener
- public class GLWindowCloser
- extends WindowCloser
This class closes Window
s 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 Window
s.
This class is special, because it is specially made for Window
s
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. |
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.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
glcanvas
protected gl4java.awt.GLCanvas glcanvas
- The
GLCanvas
that needs a dispose before the window it is in is
disposed.
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.
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.