public class KDialog extends JDialog
KDialog
is a trivial extension of JDialog
that provides support for tiling the background of the dialog with an
image and for firing dismissal events.
KDialog
introduces the notion of a cancelled
dialog versus an accepted dialog. Collectively, these are known as
dialog dismissals. A dialog may be cancelled by
pressing a Cancel button or by closing the dialog window
altogether. A dialog may be accepted by pressing an OK button
or entering a value in one of the dialog's input components. It is
ultimately up to the subclasser to determine what constitutes a dialog
dismissal. The convenience method fireDialogDismissed()
is
provided to generate dialog dismissal events. See
ComponentDialog
for an example of this functionality.
KPanel
,
KFrame
,
ComponentDialog
,
DialogDismissEvent
,
Serialized FormModifier and Type | Class and Description |
---|---|
private class |
KDialog._PropertyChangeListener |
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 Vector |
_listeners |
private KPanel |
_main |
private boolean |
cancelled |
private KDialog._PropertyChangeListener |
propListener |
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 |
---|
KDialog(Dialog parent,
String title,
boolean modal)
Construct a new
KDialog . |
KDialog(Frame parent,
String title,
boolean modal)
Construct a new
KDialog . |
Modifier and Type | Method and Description |
---|---|
private void |
_init() |
protected boolean |
accept()
Accept user input.
|
void |
addDialogDismissListener(DialogDismissListener listener)
Add a
DialogDismissListener to this dialog's list of
listeners. |
protected boolean |
canCancel()
Determine if the dialog can be cancelled.
|
protected void |
cancel()
Cancel the dialog.
|
protected boolean |
canClose()
Determine if this dialog can be closed.
|
void |
destroy()
Destroy this dialog.
|
protected void |
doAccept()
Programmatically accept user input.
|
protected void |
doCancel()
Programmatically cancel the dialog.
|
protected void |
fireDialogDismissed(int type)
Fire a dialog dismissed event.
|
protected void |
fireDialogDismissed(int type,
Object userObj)
Fire a dialog dismissed event.
|
protected KPanel |
getMainContainer()
Get a reference to the main container (in this case, the
KPanel that is the child of the frame's content pane). |
boolean |
isCancelled()
Get the cancelled state of the dialog.
|
void |
removeDialogDismissListener(DialogDismissListener listener)
Remove a
DialogDismissListener from this dialog's list
of listeners. |
void |
setBusyCursor(boolean flag)
Turn the busy cursor on or off for this dialog.
|
protected void |
setCancelled(boolean flag)
Set the cancelled state of the dialog.
|
void |
setFont(Font font)
Set the font for this dialog window.
|
void |
setTexture(Image image)
Set the background image for the dialog.
|
void |
setVisible(boolean flag)
Show or hide the dialog.
|
protected void |
startFocus()
This method is called when the dialog is made visible; it should
transfer focus to the appropriate child component.
|
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 KDialog._PropertyChangeListener propListener
private Vector _listeners
private boolean cancelled
public KDialog(Dialog parent, String title, boolean modal)
KDialog
.parent
- The parent dialog for this dialog.title
- The title for this dialog.modal
- A flag specifying whether this dialog should be modal.private void _init()
protected KPanel getMainContainer()
KPanel
that is the child of the frame's content pane).public void setTexture(Image image)
image
- The new background image.public void addDialogDismissListener(DialogDismissListener listener)
DialogDismissListener
to this dialog's list of
listeners.listener
- The listener to add.removeDialogDismissListener(kiwi.event.DialogDismissListener)
public void removeDialogDismissListener(DialogDismissListener listener)
DialogDismissListener
from this dialog's list
of listeners.listener
- The listener to remove.addDialogDismissListener(kiwi.event.DialogDismissListener)
protected void fireDialogDismissed(int type)
type
- The event type.protected void fireDialogDismissed(int type, Object userObj)
type
- The event type.userObj
- An arbitrary user object argument to pass in the event.public void setVisible(boolean flag)
setVisible
in class Dialog
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.startFocus()
protected void startFocus()
public void setBusyCursor(boolean flag)
flag
- If true
, the wait cursor will be set for
this dialog, otherwise the default cursor will be set.protected boolean canClose()
true
if the dialog may be closed, and
false
otherwise. The default implementation returns
true
.public void destroy()
UIChanageManager
.protected boolean accept()
true
, the dialog disappears; otherwise, it remains
on the screen. This method can be overridden to check input in
the dialog before allowing it to be dismissed. The default
implementation of this method returns true
.true
if the dialog may be dismissed, and
false
otherwise.protected void doAccept()
protected void cancel()
protected void doCancel()
public boolean isCancelled()
true
if the dialog was cancelled, and
false
otherwise.protected void setCancelled(boolean flag)
KDialog
directory may use this method to record the
fact that the dialog was cancelled.protected boolean canCancel()
true
.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses