|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.awt.event.WindowAdapter
kirk.gui.closer.WindowCloser
kirk.gui.closer.FinishingCloser
This class closes Windows that generate WindowEvents
asking for it. Also, it calls finish() of the class specified on
construction (which must implement Finisher). This does not have to
be the same class as the Window that is being closed.
finish() can then do stuff before the window is being closed, and it
can even stop the window from being closed by returning false.
Note that this elaborate implementation does not do much more than saving you
of writing some Window closing code, but it adds to encapsulation and
you don't have to extend WindowAdapter if you want only closing
stuff. Thus you are able to extend another class. This saves a lot of unneccesary
code of implementing WindowListener. Also, it stays in line with just
adding a dedicated WindowCloser. This was all I could do to make me
feel I didn't write useless code (^^)
Window,
Finisher| Field Summary | |
protected Finisher |
finisher
The object we will call the finish() method of before closing the passed Window. |
| Fields inherited from class kirk.gui.closer.WindowCloser |
exit |
| Constructor Summary | |
FinishingCloser(boolean exit,
Finisher finisher)
Constructs a FinishingCloser with the passed
Finisher and the given closing option. |
|
FinishingCloser(Finisher finisher)
Constructs a FinishingCloser with the passed
Finisher that does not end the program after closing. |
|
| Method Summary | |
void |
windowClosing(WindowEvent event)
Makes the associated Finisher do its thing and closes the passed
Window. |
| 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 |
protected Finisher finisher
Window.
| Constructor Detail |
public FinishingCloser(boolean exit,
Finisher finisher)
FinishingCloser with the passed
Finisher and the given closing option.
exit - true if the program should exit after closing a
window, false otherwise.finisher - The associated Finisher.public FinishingCloser(Finisher finisher)
FinishingCloser with the passed
Finisher that does not end the program after closing.
finisher - The associated Finisher.| Method Detail |
public void windowClosing(WindowEvent event)
Finisher do its thing and closes the passed
Window.
windowClosing in interface WindowListenerwindowClosing in class WindowCloserevent - The event that indicates which Window to close.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||