public class WizardDialog
extends javax.swing.JDialog
implements java.awt.event.ActionListener
When the user backs up by one or more steps, the dialog keeps the completed steps so that they can be reused if the user doesn't change anything - this handles the cases where the user backs up a few steps just to review what has been completed.
But if the user changes some options in an earlier step, then the dialog may have to discard the later steps and have them repeated.
THIS CLASS IS NOT WORKING CORRECTLY YET.
javax.swing.JDialog.AccessibleJDialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
private WizardPanel |
currentPanel
A reference to the current panel.
|
private javax.swing.JButton |
finishButton
A handy reference to the "finish" button.
|
private javax.swing.JButton |
helpButton
A handy reference to the "help" button.
|
private javax.swing.JButton |
nextButton
A handy reference to the "next" button.
|
private java.util.List |
panels
A list of references to the panels the user has already seen - used for navigating through
the steps that have already been completed.
|
private javax.swing.JButton |
previousButton
A handy reference to the "previous" button.
|
private java.lang.Object |
result
The end result of the wizard sequence.
|
private int |
step
The current step in the wizard process (starting at step zero).
|
accessibleContext, rootPane, rootPaneCheckingEnabled
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
WizardDialog(javax.swing.JDialog owner,
boolean modal,
java.lang.String title,
WizardPanel firstPanel)
Standard constructor - builds and returns a new WizardDialog.
|
WizardDialog(javax.swing.JFrame owner,
boolean modal,
java.lang.String title,
WizardPanel firstPanel)
Standard constructor - builds a new WizardDialog owned by the specified JFrame.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
Handles events.
|
boolean |
canDoNextPanel()
Returns true if there is a 'next' panel, and false otherwise.
|
boolean |
canDoPreviousPanel()
Returns true if it is possible to back up to the previous panel, and false otherwise.
|
boolean |
canFinish()
Returns true if it is possible to finish the sequence at this point (possibly with defaults
for the remaining entries).
|
javax.swing.JPanel |
createContent()
Creates a panel containing the user interface for the dialog.
|
private void |
enableButtons()
Enables/disables the buttons according to the current step.
|
void |
finish()
Finishes the wizard.
|
java.lang.Object |
getResult()
Returns the result of the wizard sequence.
|
int |
getStepCount()
Returns the total number of steps in the wizard sequence, if this number is known.
|
WizardPanel |
getWizardPanel(int step)
Returns the panel for the specified step (steps are numbered from zero).
|
boolean |
isCancelled()
Checks, whether the user cancelled the dialog.
|
void |
next()
Displays the next step in the wizard sequence.
|
void |
previous()
Handles a click on the "previous" button, by displaying the previous panel in the sequence.
|
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, setVisible, 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, setFont, 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 java.lang.Object result
private int step
private WizardPanel currentPanel
private java.util.List panels
private javax.swing.JButton previousButton
private javax.swing.JButton nextButton
private javax.swing.JButton finishButton
private javax.swing.JButton helpButton
public WizardDialog(javax.swing.JDialog owner, boolean modal, java.lang.String title, WizardPanel firstPanel)
owner
- the owner.modal
- modal?title
- the title.firstPanel
- the first panel.public WizardDialog(javax.swing.JFrame owner, boolean modal, java.lang.String title, WizardPanel firstPanel)
owner
- the owner.modal
- modal?title
- the title.firstPanel
- the first panel.public java.lang.Object getResult()
public int getStepCount()
public boolean canDoPreviousPanel()
public boolean canDoNextPanel()
public boolean canFinish()
public WizardPanel getWizardPanel(int step)
step
- the current step.public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
event
- the event.public void previous()
public void next()
public void finish()
private void enableButtons()
public boolean isCancelled()
public javax.swing.JPanel createContent()