org.freixas.jwizard
Class JWizardPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.freixas.jwizard.JWizardPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JWizardPanel
extends JPanel

This class creates a panel that can be used for a single step in a Wizard dialog. See the class documentation for JWizardDialog for more information on using this class together with JWizardDialog.

Components added to this panel should be added to the panel returned by getContentPanel().


This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License. You should have received a copy of the Artistic License along with this program. If not, a copy is available at opensource.org.

Author:
Antonio Freixas
See Also:
JWizardDialog, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JWizardPanel()
          Creates a new JWizardPanel with a double buffer and a flow layout.
JWizardPanel(boolean isDoubleBuffered)
          Creates a new JWizardPanel a flow layout and the specified buffering strategy.
JWizardPanel(LayoutManager layout)
          Create a new buffered JWizardPanel with the specified layout manager.
JWizardPanel(LayoutManager layout, boolean isDoubleBuffered)
          Creates a new JWizardPanel with the specified layout manager and buffering strategy.
 
Method Summary
 void addNotify()
          Do not call directly.
protected  void back()
          Called when the Back button is pressed.
 int getBackStep()
          Get the wizard step to go to when the Back button is pressed.
 JPanel getContentPane()
          Get a JPanel to use for adding your own components to this WizardPanel.
 int getNextStep()
          Get the wizard step to go to when the Next button is pressed.
 String getStepTitle()
          Get the step title to use for this step.
 JWizardDialog getWizardParent()
          Returns the JWizardDialog in which this JWizardPanel resides.
protected  void help()
          Called when the Help button is pressed.
protected  void makingVisible()
          Called just prior to making this panel visible.
protected  void next()
          Called when the Next button is pressed.
 void setBackStep(int backStep)
          Set the wizard step to go to when the Back button is pressed.
 void setNextStep(int nextStep)
          Set the wizard step to go to when the Next button is pressed.
 void setStepTitle(String stepTitle)
          Set the title to use for this step.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, 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, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
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, 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, 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, hide, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JWizardPanel

public JWizardPanel()
Creates a new JWizardPanel with a double buffer and a flow layout. The flow layout is assigned to the panel accessed through getContentPane().


JWizardPanel

public JWizardPanel(LayoutManager layout)
Create a new buffered JWizardPanel with the specified layout manager. The layout is assigned to the panel accessed through getContentPane().

Parameters:
layout - The LayoutManager for the content pane.

JWizardPanel

public JWizardPanel(boolean isDoubleBuffered)
Creates a new JWizardPanel a flow layout and the specified buffering strategy. If isDoubleBuffered is true, the JWizardPanel will use a double buffer. The layout is assigned to the panel accessed through getContentPane().

Parameters:
isDoubleBuffered - True for double-buffering, which uses additional memory space to achieve fast, flicker-free updates.

JWizardPanel

public JWizardPanel(LayoutManager layout,
                    boolean isDoubleBuffered)
Creates a new JWizardPanel with the specified layout manager and buffering strategy. The layout is assigned to the panel accessed through getContentPane().

Parameters:
layout - The LayoutManager for the content pane.
isDoubleBuffered - True for double-buffering, which uses additional memory space to achieve fast, flicker-free updates.
Method Detail

setStepTitle

public void setStepTitle(String stepTitle)
Set the title to use for this step. Normally this title would be unique for each wizards step.

Parameters:
stepTitle - The title to use for this step.

getStepTitle

public String getStepTitle()
Get the step title to use for this step.

Returns:
The step title to use for this step.

getContentPane

public JPanel getContentPane()
Get a JPanel to use for adding your own components to this WizardPanel. Do not add components directly to the JWizardPanel. The JPanel uses the layout given in the JWizardPanel constructor.

Returns:
The JPanel to use for adding components for this wizard step.

getBackStep

public int getBackStep()
Get the wizard step to go to when the Back button is pressed.

Returns:
The wizard step to go to when the Back button is pressed.

setBackStep

public void setBackStep(int backStep)
Set the wizard step to go to when the Back button is pressed. This should be set in the constructor of the JWizardPanel subclass since it determines whether the Back button is enabled or not.

Parameters:
backStep - The wizard step to go to when the Back button is pressed.

getNextStep

public int getNextStep()
Get the wizard step to go to when the Next button is pressed.

Returns:
The wizard step to go to when the Next button is pressed.

setNextStep

public void setNextStep(int nextStep)
Set the wizard step to go to when the Next button is pressed. This should be set in the constructor of the JWizardPanel subclass since it determines whether the Next and Finish buttons are enabled or not.

Parameters:
nextStep - The wizard step to go to when the Next button is pressed.

getWizardParent

public JWizardDialog getWizardParent()
Returns the JWizardDialog in which this JWizardPanel resides. This is valid only after the panel has been added to the dialog.

Returns:
The JWizardDialog in which this JWizardPanel resides.

addNotify

public void addNotify()
Do not call directly.

Overrides:
addNotify in class JComponent

makingVisible

protected void makingVisible()
Called just prior to making this panel visible. This is a hook in case information in the panel needs to be created dynamically based on previous steps.


back

protected void back()
Called when the Back button is pressed. By default this displays the wizard step set by setBackStep().

See Also:
setBackStep(int)

next

protected void next()
Called when the Next button is pressed. By default this displays the wizard step set by setNextStep().

See Also:
setNextStep(int)

help

protected void help()
Called when the Help button is pressed. By default this does nothing.


Copyright © 2004-2005 Antonio Freixas
Licensed under the Artistic License