|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.AbstractButton
javax.swing.JButton
jview.JExitButton
public class JExitButton
A JExit button is used for terminating the currently running java
VM with a call to System.exit. On construct this
button adds himself as an action listener. If the exit button is called,
a confirm dialog is poped up. Only if the user confirms the exit
routine with 'ok' the VM is really exited. Additionally the
exit button supports a 'quick-exit'. Pressing Ctrl-x terminates
the VM without asking for confirmation.
Independently from the way the application is terminated, all
ExitCleaning instances that had been registered to this exit button
are served in the way that their ExitCleaning.exit() method is called
before terminating the VM.
| Nested Class Summary | |
|---|---|
static class |
JExitButton.Display
For display purpose only. |
| Nested classes/interfaces inherited from class javax.swing.JButton |
|---|
JButton.AccessibleJButton |
| Nested classes/interfaces inherited from class javax.swing.AbstractButton |
|---|
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private static String |
ACCELERATE
A string defining accelerated exit via a keyboard shortcut. |
private JConfirmDialog |
confirm
The confirm dialog that pops up. |
private ExitAction |
doexit
The exit action implementation to call on button presses. |
static String |
EXITMESSAGE
The exit-confirmal message to display. |
private Vector |
onexit
A vector of all exit cleaners to be called before system exit. |
static String |
TOOLTIP
The tool-tip for the exit button. |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JExitButton()
Chained constructor. |
|
JExitButton(Action a)
Chained constructor. |
|
JExitButton(Icon i)
Chained constructor. |
|
JExitButton(String text)
Chained constructor. |
|
JExitButton(String text,
Icon i)
Chained constructor. |
|
| Method Summary | |
|---|---|
void |
addExitCleaner(ExitCleaning clean)
Adds an object that needs exit cleanup before system exit. |
void |
init()
Initializes the button as an action listener for itself. |
void |
performExit()
This method is called when a confirmed exit occurs. |
void |
registerExitAction(ExitAction exit)
Register the exit action implementation. |
boolean |
removeExitCleaner(ExitCleaning clean)
Removes an object that needs exit cleanup before system exit from this exit buttons list. |
| Methods inherited from class javax.swing.JButton |
|---|
getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String EXITMESSAGE
public static final String TOOLTIP
private static final String ACCELERATE
private JConfirmDialog confirm
private Vector onexit
private ExitAction doexit
| Constructor Detail |
|---|
public JExitButton()
public JExitButton(Action a)
public JExitButton(String text)
public JExitButton(Icon i)
public JExitButton(String text,
Icon i)
| Method Detail |
|---|
public void init()
Registers an action object using a confirmative dialog if envoked
with the mouse or shortcuts on keyboard accelerators.
A modal confirmation dialog is then poped up. To this
dialog a window event listener registers, waiting for the window
closed event. In this case, the dialog is asked whether it was
confirmed or not. In the first case, all registered
ExitCleaning.exit() methods are called before
System.exit is called.
init in interface Initializablepublic void registerExitAction(ExitAction exit)
public void addExitCleaner(ExitCleaning clean)
public boolean removeExitCleaner(ExitCleaning clean)
public void performExit()
ExitCleaning instances
are cleaned by calling their ExitCleaning.exit() method.
performExit in interface ExitAction
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||