org.xnap.gui.component
Class DefaultDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by org.xnap.gui.component.DefaultDialog
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants
Direct Known Subclasses:
AboutDialog, AbstractPreferencesDialog, ConsoleDialog, DefaultWizardDialog, DependencyGraphDialog, Dialogs.NotificationDialog, DirectoryChooser, ErrorDialog, FontChooserDialog, GlobalOpenNapUserEditorDialog, HelpDialog, OpenNapDownloadContainerEditorDialog, OpenNapServerEditorDialog, PackageDialog, PircBotServerDialog, PluginDetailsDialog, PluginDialog, ProgressDialog

public class DefaultDialog
extends javax.swing.JDialog

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.

If you extend this class make sure pack() is called after all components have been added.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.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_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(int buttons)
           
DefaultDialog(int buttons, boolean exitOnEnter)
           
DefaultDialog(int buttons, javax.swing.JComponent component)
           
DefaultDialog(int buttons, javax.swing.JComponent component, boolean exitOnEnter)
          Constructs a dialog.
 
Method Summary
 boolean apply()
          Called by ApplyAction and OkayAction when the dialog is closed.
 void close()
          Disposes the dialog.
 javax.swing.JPanel getButtonPanel()
          Returns the button panel.
 javax.swing.Action getCancelAction()
          Returns the cancel action.
 javax.swing.Action getCloseAction()
          Returns the close action.
 javax.swing.JPanel getMainPanel()
          Returns the main panel.
 javax.swing.Action getOkayAction()
          Returns the cancel action.
 javax.swing.JPanel getTopPanel()
          Returns the top most panel.
 boolean isOkay()
          Returns true, if the dialog was closed with the Okay button.
 void setMainComponent(java.awt.Component component)
          Sets the main component to component.
 void show(java.awt.Component c)
          Sets this dialogs position relative to c and makes it visible.
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
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, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, 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, isOpaque, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BUTTON_NONE

public static int BUTTON_NONE
The button type for no buttons.


BUTTON_OKAY

public static int BUTTON_OKAY
The button type for the okay button.


BUTTON_APPLY

public static int BUTTON_APPLY
The button type for the apply button.


BUTTON_CANCEL

public static int BUTTON_CANCEL
The button type for the cancel button.


BUTTON_CLOSE

public static int BUTTON_CLOSE
The button type for the close button.


BUTTON_HELP

public static int BUTTON_HELP
The button type for the help button.


BUTTON_CONTEXT_HELP

public static int BUTTON_CONTEXT_HELP
The button type for the context help button.


isOkay

protected boolean isOkay
Constructor Detail

DefaultDialog

public DefaultDialog(int buttons,
                     javax.swing.JComponent component,
                     boolean exitOnEnter)
Constructs a dialog. The escape key is by default bound to the cancel button.

Parameters:
buttons - a logical and combination of button type constants
component - the main component that is centered in the dialog
exitOnEnter - execute the okay action when the user presses enter

DefaultDialog

public DefaultDialog(int buttons,
                     javax.swing.JComponent component)

DefaultDialog

public DefaultDialog(int buttons,
                     boolean exitOnEnter)

DefaultDialog

public DefaultDialog(int buttons)

DefaultDialog

public DefaultDialog()
Constructs a dialog with an okay and cancel button.

Method Detail

apply

public boolean apply()
Called by ApplyAction and OkayAction when the dialog is closed.

Returns:
true, if apply was successful and close() should be invoked; false, otherwise
Throws:
java.lang.IllegalArgumentException

close

public void close()
Disposes the dialog. Called by the actions to close the dialog. Sub classes can reimplement this.

See Also:
isOkay()

getButtonPanel

public javax.swing.JPanel getButtonPanel()
Returns the button panel. Sub classes can add aditional buttons to this panel.


getCancelAction

public javax.swing.Action getCancelAction()
Returns the cancel action.


getOkayAction

public javax.swing.Action getOkayAction()
Returns the cancel action.


getCloseAction

public javax.swing.Action getCloseAction()
Returns the close action.


setMainComponent

public void setMainComponent(java.awt.Component component)
Sets the main component to component.


getMainPanel

public javax.swing.JPanel getMainPanel()
Returns the main panel. Sub classes can add components to this panel.


getTopPanel

public javax.swing.JPanel getTopPanel()
Returns the top most panel.


isOkay

public boolean isOkay()
Returns true, if the dialog was closed with the Okay button.


show

public void show(java.awt.Component c)
Sets this dialogs position relative to c and makes it visible.



Copyright © 2001-2005 XNap Team. All Rights Reserved.