public class PWizard extends JPanel
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected static String |
CANCEL
The property issued for cancelling the wizard
|
static int |
CANCEL_OPTION
Return value if Cancel is chosen
|
protected static String |
FINISH
The property issued when finishing wizard processing
|
static int |
FINISH_OPTION
Return value if Finish is chosen
|
protected static String |
HELP
The property issued for showing help
|
protected static String |
PAGE_SWITCH
The property issued when a page changes
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
PWizard()
Create an instance of the wizard with no owner that is modeless and which contains a navigator
|
PWizard(JFrame owner,
boolean modal,
boolean useNavigator)
Creates an instance of the wizard with the specified owner that is optionally modeless and which
optionally contains a navigator
|
Modifier and Type | Method and Description |
---|---|
void |
addButtonPanelElement(Component comp,
int gap)
Inserts an element into the wizard button panel just to the left of
the "Back" button.
|
protected void |
addCancelListener(PropertyChangeListener p)
Registers the given listener so that it receives a
CANCEL PropertyChangeEvent event when a cancel has occurred |
protected void |
addCancelVetoableListener(VetoableChangeListener v)
Registers the given listener so that it receives a
CANCEL VetoableChangeEvent before a cancel occurs |
protected void |
addFinishListener(PropertyChangeListener p)
Registers the given listener so that it receives a
FINISH PropertyChangeEvent event when a finish has occurred |
protected void |
addFinishVetoableListener(VetoableChangeListener v)
Registers the given listener so that it receives a
FINISH VetoableChangeEvent before a finish occurs |
protected void |
addHelpListener(PropertyChangeListener p)
Registers the given listener so that it receives a
HELP PropertyChangeEvent event when a cancel has occurred |
void |
addNotify() |
void |
addPage(Component page)
Adds a page to the wizard
|
protected void |
addPageSwitchListener(PropertyChangeListener p)
Registers the given listener so that it receives a
PAGE_SWITCH PropertyChangeEvent event when a page switch
has occurred. |
protected void |
addPageSwitchVetoableListener(VetoableChangeListener v)
Registers the given listener so that it receives a
PAGE_SWITCH VetoableChangeEvent before a page switch
occurs. |
Component |
getPageAt(int i)
For the given index, retrieves the associated page
|
int |
getPageCount()
Returns the total number of pages in the wizard
|
Component |
getVisiblePage()
Retrieves the currently visible page
|
int |
getVisiblePageIndex()
Retrieves the index of the currently visible page
|
JDialog |
getWizardDialog()
Returns the wizard dialog
|
int |
pageToIndex(Component c)
For the given page, retrieves the associated index.
|
void |
processBack()
Moves to the previous page in the wizard.
|
void |
processCancel()
Cancels wizard processing.
|
void |
processFinish()
Finishes wizard processing.
|
void |
processHelp(ActionEvent e)
Displays wizard help.
|
void |
processNext()
Moves to the next visible page in the wizard.
|
protected void |
removeCancelCommand()
Removes the visual cancel command (button) from the wizard
|
protected void |
removeCancelListener(PropertyChangeListener p)
Removes the PropertyChangeListener for the
CANCEL property |
protected void |
removeCancelVetoableListener(VetoableChangeListener v)
Removes the VetoableChangeListener for the
CANCEL property |
protected void |
removeFinishCommand()
Removes the visual cancel command (button) from the wizard
|
protected void |
removeFinishListener(PropertyChangeListener p)
Removes the PropertyChangeListener for the
FINISH property |
protected void |
removeFinishVetoableListener(VetoableChangeListener v)
Removes the VetoableChangeListener for the
FINISH property |
protected void |
removeHelpCommand()
Removes the visual help command (button) from the wizard
|
protected void |
removeHelpListener(PropertyChangeListener p)
Removes the PropertyChangeListener for the
HELP property |
void |
removeNotify() |
protected void |
removePageSwitchListener(PropertyChangeListener p)
Removes the PropertyChangeListener for the
PAGE_SWITCH
property. |
protected void |
removePageSwitchVetoableListener(VetoableChangeListener v)
Removes the VetoableChangeListener for the
PAGE_SWITCH property |
void |
setFinishButtonEnabled(boolean b)
Gives the user control over the finish button
|
void |
setPageEnabled(Component p,
boolean b)
Enables or disables the passed-in page and its navigator button if
the navigator is present.
|
void |
setVisible(boolean b)
Shows or hides the wizard dialog.
|
void |
setVisiblePage(int index)
Switches to the page at the specified index.
|
int |
showWizard()
Shows the dialog containing the wizard panel.
|
void |
showWizardPage(int index,
boolean force)
Switches the wizard to the page having the passed-in index.
|
void |
showWizardPage(String page,
boolean force)
Switches the wizard to the passed-in page.
|
void |
updateWizardControls()
Updates the wizard controls
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int CANCEL_OPTION
public static final int FINISH_OPTION
protected static final String HELP
protected static final String PAGE_SWITCH
protected static final String CANCEL
protected static final String FINISH
public PWizard()
public PWizard(JFrame owner, boolean modal, boolean useNavigator)
owner
- the Frame that owns the wizardmodal
- true for a modal wizard; false for one that allows others windows to be active at the same timeuseNavigator
- true for the wizard to contain a navigator allowing for random page selection; false otherwisepublic int showWizard()
FINISH_OPTION
if exiting after the Finish button
was pressed or CANCEL_OPTION
if exiting after the
Cancel button was pressed.public void addNotify()
addNotify
in class JComponent
public void removeNotify()
removeNotify
in class JComponent
public JDialog getWizardDialog()
public void setFinishButtonEnabled(boolean b)
b
- Sets the enabled state of the finish buttonpublic void setVisible(boolean b)
setVisible
in class JComponent
b
- If true
, shows the dialog; otherwise, hides it.protected void removeHelpCommand()
protected void removeCancelCommand()
protected void removeFinishCommand()
public void addButtonPanelElement(Component comp, int gap)
comp
- Element to add to the left of the "Back" button.gap
- Padding to separate the new element from the "Back" button.public void addPage(Component page)
page
- Page to add to the wizardpublic void setVisiblePage(int index)
index
- The index of the page to display.public void processNext()
PAGE_SWITCH
.public void processBack()
PAGE_SWITCH
.public void showWizardPage(String page, boolean force)
PAGE_SWITCH
.page
- Name of page to switch toforce
- true
to force a redisplay even if the page
hasn't changed; false otherwise.showWizardPage(int, boolean)
public void showWizardPage(int index, boolean force)
PAGE_SWITCH
.index
- Index of page to switch toforce
- true
to force a redisplay even if the page
hasn't changed; false otherwiseaddPageSwitchListener(java.beans.PropertyChangeListener)
,
addPageSwitchVetoableListener(java.beans.VetoableChangeListener)
public void setPageEnabled(Component p, boolean b)
p
is the currently selected page.p
- The page whose button is to be enabled or disabled.b
- true
to attempt to enable the page and button;
false
to attempt to disable them.public void processFinish()
FINISH
.public void processCancel()
CANCEL
.public void processHelp(ActionEvent e)
public int getPageCount()
public Component getPageAt(int i)
i
- The index to look uppublic int pageToIndex(Component c)
c
- The page to look uppublic Component getVisiblePage()
public int getVisiblePageIndex()
public void updateWizardControls()
protected void addPageSwitchListener(PropertyChangeListener p)
PAGE_SWITCH
PropertyChangeEvent event when a page switch
has occurred.p
- The listenerprotected void removePageSwitchListener(PropertyChangeListener p)
PAGE_SWITCH
property.p
- The listenerprotected void addPageSwitchVetoableListener(VetoableChangeListener v)
PAGE_SWITCH
VetoableChangeEvent before a page switch
occurs.v
- The VetoableChangeListenerprotected void removePageSwitchVetoableListener(VetoableChangeListener v)
PAGE_SWITCH
propertyv
- The listenerprotected void addCancelListener(PropertyChangeListener p)
CANCEL
PropertyChangeEvent event when a cancel has occurredp
- The listenerprotected void removeCancelListener(PropertyChangeListener p)
CANCEL
propertyp
- The listenerprotected void addCancelVetoableListener(VetoableChangeListener v)
CANCEL
VetoableChangeEvent before a cancel occursv
- The VetoableChangeListenerprotected void removeCancelVetoableListener(VetoableChangeListener v)
CANCEL
propertyv
- The listenerprotected void addFinishListener(PropertyChangeListener p)
FINISH
PropertyChangeEvent event when a finish has occurredp
- The listenerprotected void removeFinishListener(PropertyChangeListener p)
FINISH
propertyp
- The listenerprotected void addFinishVetoableListener(VetoableChangeListener v)
FINISH
VetoableChangeEvent before a finish occursv
- The VetoableChangeListenerprotected void removeFinishVetoableListener(VetoableChangeListener v)
FINISH
propertyv
- The listenerprotected void addHelpListener(PropertyChangeListener p)
HELP
PropertyChangeEvent event when a cancel has occurredp
- The listenerprotected void removeHelpListener(PropertyChangeListener p)
HELP
propertyp
- The listenerCopyright © 2003, 2023, Oracle and/or its affiliates.