|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | 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 | +--kiwi.ui.dialog.KDialog | +--kiwi.ui.dialog.ComponentDialog
A base class for custom dialog windows. This class provides some base functionality that can be useful across many different types of dialogs. The class constructs a skeleton dialog consisting of an optional comment line, an icon, OK and Cancel buttons, and a middle area that must be filled in by subclassers.
A ComponentDialog
is accepted by clicking the
OK button, though subclassers can determine the conditions under
which a dialog may be accepted by overriding the accept()
method; it is cancelled by clicking the Cancel button or
closing the window.
Inner classes inherited from class javax.swing.JDialog |
JDialog.AccessibleJDialog |
Field Summary | |
protected KButton |
b_cancel
The Cancel button. |
protected KButton |
b_ok
The OK button. |
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 |
Constructor Summary | |
ComponentDialog(Frame parent,
String title,
boolean modal)
Construct a new ComponentDialog . |
|
ComponentDialog(Frame parent,
String title,
boolean modal,
boolean hasCancel)
Construct a new ComponentDialog . |
Method Summary | |
protected boolean |
accept()
Accept user input. |
protected void |
addButton(JButton button)
Add a button to the dialog's button panel. |
protected void |
addButton(JButton button,
int pos)
Add a button to the dialog's button panel at the specified position. |
protected abstract Component |
buildDialogUI()
Construct the component that will be displayed in the center of the dialog window. |
protected void |
cancel()
Cancel the dialog. |
boolean |
isCancelled()
Get the cancelled state of the dialog. |
void |
pack()
This is overridden to fix a Swing layout bug. |
protected void |
registerTextInputComponent(JTextField c)
Register a text field with this dialog. |
protected void |
removeButton(int pos)
Remove a button from the specified position in the dialog's button panel. |
protected void |
removeButton(JButton button)
Remove a button from the dialog's button panel. |
void |
setAcceptButtonText(String text)
Set the label text for the OK button. |
void |
setCancelButtonText(String text)
Set the label text for the Cancel button. |
protected void |
setComment(String comment)
Change the dialog's comment. |
void |
setIcon(Icon icon)
Get the icon to display in the left part of the dialog window. |
void |
setVisible(boolean flag)
Show or hide the dialog. |
Methods inherited from class kiwi.ui.dialog.KDialog |
addDialogDismissListener,
dispose,
fireDialogDismissed,
fireDialogDismissed,
getMainContainer,
removeDialogDismissListener,
setTexture |
Methods inherited from class java.awt.Dialog |
addNotify,
getTitle,
isModal,
isResizable,
setModal,
setResizable,
setTitle,
show |
Methods inherited from class java.awt.Window |
addWindowListener,
applyResourceBundle,
applyResourceBundle,
finalize,
getFocusOwner,
getInputContext,
getLocale,
getOwnedWindows,
getOwner,
getToolkit,
getWarningString,
isShowing,
postEvent,
processEvent,
removeWindowListener,
toBack,
toFront |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getInsets,
getLayout,
getMaximumSize,
getMinimumSize,
getPreferredSize,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paint,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setFont,
validate,
validateTree |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected KButton b_ok
protected KButton b_cancel
Constructor Detail |
public ComponentDialog(Frame parent, String title, boolean modal)
ComponentDialog
.parent
- The parent frame for this dialog.title
- The title for this dialog's window.modal
- A flag specifying whether this dialog will be modal.public ComponentDialog(Frame parent, String title, boolean modal, boolean hasCancel)
ComponentDialog
.parent
- The parent frame for this dialog.title
- The title for this dialog's window.modal
- A flag specifying whether this dialog will be modal.hasCancel
- A flag specifying whether this dialog should have a
Cancel button.Method Detail |
protected abstract Component buildDialogUI()
Component
to display in the dialog.public void setVisible(boolean flag)
protected void registerTextInputComponent(JTextField c)
KInputDialog
, pressing Return in a text field is
equivalent to pressing the dialog's OK button. Subclassers may use
this method to register a text field that should function in this way.c
- The JTextField
to register.public void pack()
protected void setComment(String comment)
comment
- The new text to display in the comment portion of the
dialog.public void setIcon(Icon icon)
Icon
to display in the dialog.public boolean isCancelled()
protected boolean accept()
protected void cancel()
protected void addButton(JButton button)
button
- The button to add.protected void addButton(JButton button, int pos) throws IllegalArgumentException
button
- The button to add.pos
- The position at which to add the button. A value of 0 denotes
the first position, and -1 denotes the last position. The possible
range of values for pos
excludes the OK and
(if present) Cancel buttons; buttons may not be added after
these "fixed" buttons.protected void removeButton(JButton button)
button
- The button to remove. Neither the OK nor the
Cancel button may be removed.protected void removeButton(int pos)
button
- The button to remove.pos
- The position of the button to remove, where 0 denotes
the first position, and -1 denotes the last position. The possible
range of values for pos
excludes the OK and
(if present) Cancel buttons; these "fixed" buttons may not be
removed.public void setAcceptButtonText(String text)
text
- The text for the accept button (for example, "Yes").public void setCancelButtonText(String text)
text
- The text for the cancel button (for example, "No").
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |