|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.util.CloseWindowAdaptor
public class CloseWindowAdaptor
CloseWindowAdaptor is an adaptor object which listens for a WindowEvent and disposes a window (i.e. closes it) when a window receives a close event.
CloseWindowAdaptor closeAdaptor = new CloseWindowAdaptor(window);is all that is needed to make a
window
close when it received a close request (normally
from the window manager, such as clicking the X icon
in Microsoft Windows).
Normally, the adaptor only listens for window events from this window, but you can also add the adaptor as a window listener on other windows. For example, if you have a parent window and a non-modal dialog, you can use a CloseWindowAdaptor to close the dialog when the primary window closes:
MyAppFrame parent = new MyAppFrame(); // cause the parent window to close when it receives a close request CloseWindowAdaptor closeParent = new CloseWindowAdaptor(parent); // create a non-modal dialog Dialog d = new Dialog(parent); // allow the dialog to close itself CloseWindowAdaptor closeDialog = new CloseWindowAdaptor(dialog); // Have the parent close the dialog when the parent window closes: parent.addWindowListener(closeDialog);
The only method in the WindowListener
interface that is implemented is
windowClosing(windowEvent)
Field Summary | |
---|---|
protected java.awt.Window |
window
The window this adaptor is listening to. |
Constructor Summary | |
---|---|
CloseWindowAdaptor(java.awt.Window window)
Construct a CloseWindowAdaptor which will dispose the window when a windowClosing
event is received. |
Method Summary | |
---|---|
void |
windowActivated(java.awt.event.WindowEvent wEvent)
No op. |
void |
windowClosed(java.awt.event.WindowEvent wEvent)
No op. |
void |
windowClosing(java.awt.event.WindowEvent wEvent)
When a UI action to close the window occurs, this handler executes and disposes the window. |
void |
windowDeactivated(java.awt.event.WindowEvent wEvent)
No op. |
void |
windowDeiconified(java.awt.event.WindowEvent wEvent)
No op. |
void |
windowIconified(java.awt.event.WindowEvent wEvent)
No op. |
void |
windowOpened(java.awt.event.WindowEvent wEvent)
No op. |
Field Detail |
---|
protected java.awt.Window window
Constructor Detail |
---|
public CloseWindowAdaptor(java.awt.Window window)
windowClosing
event is received.
window
- the window to close. The new adaptor is added
as a WindowEventListener
.Method Detail |
---|
public void windowOpened(java.awt.event.WindowEvent wEvent)
windowOpened
in interface java.awt.event.WindowListener
public void windowClosing(java.awt.event.WindowEvent wEvent)
constructor
,
(which may not be the window that sends the event).
windowClosing
in interface java.awt.event.WindowListener
wEvent
- a window event. The event is ignored.public void windowClosed(java.awt.event.WindowEvent wEvent)
windowClosed
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent wEvent)
windowIconified
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent wEvent)
windowDeiconified
in interface java.awt.event.WindowListener
public void windowActivated(java.awt.event.WindowEvent wEvent)
windowActivated
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent wEvent)
windowDeactivated
in interface java.awt.event.WindowListener
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |