|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Window java.awt.Dialog javax.swing.JDialog org.xnap.commons.gui.DefaultDialog
public class DefaultDialog
This class provides a default implementation for a dialog. A dialog consists of two areas. The main area, located at the center of the dialog, contains the user interaction components. The button area, located at the south west of the dialog, is surrounded by an empty border and contains the buttons.
The most common buttons are provided with default actions.
When you extend this class make sure pack()
is called after
all components have been added.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JDialog |
---|
JDialog.AccessibleJDialog |
Nested classes/interfaces inherited from class java.awt.Dialog |
---|
Dialog.AccessibleAWTDialog |
Nested classes/interfaces inherited from class java.awt.Window |
---|
Window.AccessibleAWTWindow |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
BUTTON_APPLY
The button type for the apply button. |
static int |
BUTTON_CANCEL
The button type for the cancel button. |
static int |
BUTTON_CLOSE
The button type for the close button. |
static int |
BUTTON_CONTEXT_HELP
The button type for the context help button. |
static int |
BUTTON_DEFAULTS
The button type for the defaults button. |
static int |
BUTTON_HELP
The button type for the help button. |
static int |
BUTTON_NONE
The button type for no buttons. |
static int |
BUTTON_OKAY
The button type for the okay button. |
protected boolean |
isOkay
|
Fields inherited from class javax.swing.JDialog |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DefaultDialog()
Constructs a dialog with an okay and cancel button. |
|
DefaultDialog(Dialog owner)
Convenience wrapper for DefaultDialog(Dialog, BUTTON_OKAY | BUTTON_CANCEL) . |
|
DefaultDialog(Dialog owner,
int buttons)
Convenience wrapper for DefaultDialog(Dialog, int, null) . |
|
DefaultDialog(Dialog owner,
int buttons,
JComponent mainComponent)
Constructs a dialog showing the specified buttons and a mainComponent . |
|
DefaultDialog(Frame owner)
Convenience wrapper for DefaultDialog(Frame, BUTTON_OKAY | BUTTON_CANCEL) . |
|
DefaultDialog(Frame owner,
int buttons)
Convenience wrapper for DefaultDialog(Frame, int, null) . |
|
DefaultDialog(Frame owner,
int buttons,
JComponent mainComponent)
Constructs a dialog showing the specified buttons and a mainComponent . |
|
DefaultDialog(int buttons)
Convenience wrapper for DefaultDialog(int, null) . |
|
DefaultDialog(int buttons,
JComponent mainComponent)
Constructs a dialog. |
Method Summary | |
---|---|
boolean |
apply()
Called by ApplyAction and OkayAction when the dialog is closed. |
protected void |
cancelled()
|
void |
close()
Disposes the dialog. |
void |
contextHelp()
Invoked when the context help button is selected. |
protected void |
defaults()
|
Action |
getApplyAction()
Returns the apply action. |
JPanel |
getButtonPanel()
Returns the button panel. |
Action |
getCancelAction()
Returns the cancel action. |
Action |
getCloseAction()
Returns the close action. |
Action |
getContextHelpAction()
Returns the cancel action. |
Action |
getDefaultsAction()
Returns the defaults action. |
Action |
getHelpAction()
Returns the cancel action. |
JPanel |
getMainPanel()
Returns the main panel. |
Action |
getOkayAction()
Returns the cancel action. |
JPanel |
getTopPanel()
Returns the top most panel. |
void |
help()
Invoked when the context help is selected. |
boolean |
isOkay()
Returns true, if the dialog was closed with the Okay button. |
void |
setApplyOnEnter(boolean apply)
|
void |
setButtonSeparatorVisible(boolean visible)
|
void |
setMainComponent(Component component)
Sets the main component to component . |
void |
show(Component c)
Sets this dialogs position relative to c and makes it
visible. |
Methods inherited from class java.awt.Dialog |
---|
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int BUTTON_NONE
public static int BUTTON_OKAY
public static int BUTTON_APPLY
public static int BUTTON_CANCEL
public static int BUTTON_CLOSE
public static int BUTTON_HELP
public static int BUTTON_CONTEXT_HELP
public static int BUTTON_DEFAULTS
protected boolean isOkay
Constructor Detail |
---|
public DefaultDialog(Dialog owner, int buttons, JComponent mainComponent)
mainComponent
.
owner
- the dialog ownerbuttons
- the ored value of button codes,
e.g BUTTON_CANCEL | BUTTON_OKAYmainComponent
- the main component of the dialog, shown
in the center of the dialog.public DefaultDialog(Frame owner, int buttons, JComponent mainComponent)
mainComponent
.
owner
- the dialog ownerbuttons
- the ored value of button codes,
e.g BUTTON_CANCEL | BUTTON_OKAYmainComponent
- the main component of the dialog, shown
in the center of the dialog.public DefaultDialog(int buttons, JComponent mainComponent)
buttons
- a logical and combination of button type constantsmainComponent
- the main component that is centered in the dialogpublic DefaultDialog(Dialog owner, int buttons)
DefaultDialog(Dialog, int, null)
.
public DefaultDialog(Frame owner, int buttons)
DefaultDialog(Frame, int, null)
.
public DefaultDialog(int buttons)
DefaultDialog(int, null)
.
buttons
- public DefaultDialog(Dialog owner)
DefaultDialog(Dialog, BUTTON_OKAY | BUTTON_CANCEL)
.
public DefaultDialog(Frame owner)
DefaultDialog(Frame, BUTTON_OKAY | BUTTON_CANCEL)
.
public DefaultDialog()
Method Detail |
---|
public boolean apply()
protected void cancelled()
protected void defaults()
public void close()
isOkay()
public JPanel getButtonPanel()
public Action getApplyAction()
public Action getCancelAction()
public Action getDefaultsAction()
public Action getOkayAction()
public Action getHelpAction()
public Action getContextHelpAction()
public Action getCloseAction()
public void contextHelp()
Invokes WhatsThis.enterWhatsThisMode()
. Sub-classes may override
this method.
public void help()
Does nothing. Sub-classes may override this method.
public void setApplyOnEnter(boolean apply)
public void setMainComponent(Component component)
component
.
TODO can this be called multiple times?, it can they are all added, don't
know how this looks then
public JPanel getMainPanel()
public JPanel getTopPanel()
public void setButtonSeparatorVisible(boolean visible)
public boolean isOkay()
public void show(Component c)
c
and makes it
visible.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |