public abstract class ComponentDialog extends KDialog
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.
Modifier and Type | Class and Description |
---|---|
private class |
ComponentDialog._ActionListener |
JDialog.AccessibleJDialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
Window.AccessibleAWTWindow, Window.Type
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
private ComponentDialog._ActionListener |
actionListener |
protected KButton |
b_cancel
The Cancel button.
|
protected KButton |
b_ok
The OK button.
|
private ButtonPanel |
buttons |
private KLabel |
commentLabel |
private int |
fixedButtons |
private KLabel |
iconLabel |
private JTextField |
inputComponent |
private KPanel |
main |
accessibleContext, rootPane, rootPaneCheckingEnabled
DEFAULT_MODALITY_TYPE
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
ComponentDialog(Dialog parent,
String title,
boolean modal)
Construct a new
ComponentDialog . |
ComponentDialog(Dialog parent,
String title,
boolean modal,
boolean hasCancel)
Construct a new
ComponentDialog . |
ComponentDialog(Frame parent,
String title,
boolean modal)
Construct a new
ComponentDialog . |
ComponentDialog(Frame parent,
String title,
boolean modal,
boolean hasCancel)
Construct a new
ComponentDialog . |
Modifier and Type | Method and Description |
---|---|
private void |
_init(boolean hasCancel) |
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 boolean |
canCancel()
Determine if the dialog can be cancelled.
|
protected void |
installDialogUI()
Install the component returned by
buildDialogUI()
into the dialog. |
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.
|
(package private) void |
setButtonOpacity(boolean flag) |
void |
setCancelButtonText(String text)
Set the label text for the Cancel button.
|
void |
setComment(Icon icon,
String comment)
Change the dialog's comment.
|
void |
setComment(String comment)
Change the dialog's comment.
|
void |
setIcon(Icon icon)
Set the icon to display in the left part of the dialog
window.
|
void |
setVisible(boolean flag)
Show or hide the dialog.
|
accept, addDialogDismissListener, cancel, canClose, destroy, doAccept, doCancel, fireDialogDismissed, fireDialogDismissed, getMainContainer, isCancelled, removeDialogDismissListener, setBusyCursor, setCancelled, setFont, setTexture, startFocus
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
private ComponentDialog._ActionListener actionListener
private KLabel commentLabel
private JTextField inputComponent
private ButtonPanel buttons
private int fixedButtons
public ComponentDialog(Dialog parent, String title, boolean modal)
ComponentDialog
.parent
- The parent dialog for this dialog.title
- The title for this dialog's window.modal
- A flag specifying whether this dialog will be modal.public ComponentDialog(Dialog parent, String title, boolean modal, boolean hasCancel)
ComponentDialog
.parent
- The parent dialog 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.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.private void _init(boolean hasCancel)
protected void installDialogUI()
buildDialogUI()
into the dialog. If it is not possible to build the dialog UI at
the time that the constructor calls buildDialogUI()
,
that method should return null. The subclass constructor
can then explicitly call installDialogUI()
, at which
time buildDialogUI
should return a valid component.protected abstract Component buildDialogUI()
Component
to display in the dialog, or
null
if the component will be constructed later.public void setVisible(boolean flag)
setVisible
in class KDialog
flag
- A flag specifying whether the dialog should be shown
or hidden. If true
, the startFocus()
method is called to allow the subclasser to request focus for a
given child component.KDialog.startFocus()
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 setComment(String comment)
comment
- The new text to display in the comment portion of the
dialog.public void setComment(Icon icon, String comment)
comment
- The new text to display in the comment portion of the
dialog.icon
- An icon to display to the left of the comment text.public void setIcon(Icon icon)
icon
- The icon.protected boolean canCancel()
void setButtonOpacity(boolean flag)
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.IllegalArgumentException
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)
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").WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses