Side of Software
Wizard Library 1.6

sos.wizard
Class BasicWizardUI

java.lang.Object
  |
  +--javax.swing.plaf.ComponentUI
        |
        +--sos.wizard.WizardUI
              |
              +--sos.wizard.BasicWizardUI

public class BasicWizardUI
extends WizardUI

A basic implementation of the wizard look and feel.

This look and feel tries to follow the guidelines set forth in Java (TM) Look and Feel Design Guidelines: Advanced Topics. It installs a layout manager that lays out the panels as follows (assuming a left-to-right orientation and an English locale):

   +----------------+-------------------------------------+
   | Steps          |  Page Title                         |
   | ------------   |  --------------------------------   |
   | 1              |                                     |
   | 2              |                                     |
   | 3              |                                     |
   | 4              |             Right                   |
   |                |             Pane                    |
   |    Left        |                                     |
   |    Pane        |                                     |
   |                |                                     |
   +----------------+-------------------------------------+
   |                                                      |
   |                   < Back  Next >           Cancel    |
   |                                                      |
   +------------------------------------------------------+
 
The preferred size of a JWizard component inside a dialog is 660 x 400, subject to the maximum and minimum sizes of the component.

This class provides a number of protected method to allow subclasses to customize the behavior.

Customizable Properties

The following properties are customizable by initializing the value with the UIManager at application start-up:

PropertyUIManager KeyDefault Value
Amount of space side panel should occupy, as a percentage of the total widthACCESSORY_PERCENTAGE_KEY0.25
Mapping of keyboard events to action namesANCESTOR_INPUT_MAP_KEYEscape key maps to the "escape" action
Wizard's background colorBACKGROUND_KEYSame as "Panel.background"
Preferred height of a wizard in a dialogDIALOG_PREFERRED_HEIGHT_KEY400
Preferred width of a wizard in a dialogDIALOG_PREFERRED_WIDTH_KEY660
Wizard's foreground (i.e. text) colorFOREGROUND_KEYSame as "TextArea.foreground"
Wizard's font for ordinary textFONT_KEYSame as "TextArea.font"
Background color of a default side panel that lists the wizard stepsSTEPS_BACKGROUND_KEYSame as "TextPane.background"
Wizard's font for its titlesTITLE_FONT_KEYSame as "TextArea.font" but bolded and 20% larger

Since:
1.0
See Also:
WizardUI, JWizard

Field Summary
static java.lang.Object ACCESSORY_PERCENTAGE_KEY
          The look-and-feel key for the ideal percentage the accessory component should be in relation to the entire wizard component.
static java.lang.Object ANCESTOR_INPUT_MAP_KEY
          The look-and-feel key for the ancestor input map.
static java.lang.Object BACKGROUND_KEY
          The look-and-feel key for the background color.
static java.lang.Object DIALOG_PREFERRED_HEIGHT_KEY
          The look-and-feel key for the preferred wizard dialog height.
static java.lang.Object DIALOG_PREFERRED_WIDTH_KEY
          The look-and-feel key for the preferred wizard dialog width.
static java.lang.Object FONT_KEY
          The look-and-feel key for the font.
static java.lang.Object FOREGROUND_KEY
          The look-and-feel key for the foreground color.
static java.lang.Object STEPS_BACKGROUND_KEY
          The look-and-feel key for the background color of the accessory panel that shows the list of wizard steps.
static java.lang.Object TITLE_FONT_KEY
          The look-and-feel key for the title font.
 
Constructor Summary
BasicWizardUI()
           
 
Method Summary
protected  javax.swing.Action createBackAction()
          Creates and returns an action for the Back button.
protected  javax.swing.Action createCancelAction()
          Creates and returns an action for the Cacnel button.
protected  javax.swing.Action createCloseAction()
          Creates and returns an action for the Close button.
protected  javax.swing.Action createFinishAction()
          Creates and returns an action for the Finish button.
protected  javax.swing.Action createHelpAction()
          Creates and returns an action for the Help button.
protected  javax.swing.Action createLastAction()
          Creates and returns an action for the Last button.
protected  javax.swing.Action createNextAction()
          Creates and returns an action for the Next button.
protected  java.beans.PropertyChangeListener createPropertyChangeListener()
          Creates and returns the property change listener that will respond to changes in the JWizard.
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
          Returns an instance of the UI delegate for the specified component.
protected  javax.swing.Icon getBackButtonIcon()
          Returns the icon to use for the button that returns the wizard to the previous step.
protected  int getBackButtonMnemonic()
          Returns the mnemonic to use for the button that returns the wizard to the previous step.
protected  java.lang.String getBackButtonText()
          Returns the string to display on the button that returns the wizard to the previous step.
protected  java.lang.String getBackButtonToolTipText()
          Returns the tool tip to use for the button that returns the wizard to the previous step.
protected  java.lang.String getCancelButtonText()
          Returns the string to display on the button that cancels the wizard.
protected  java.lang.String getCancelButtonToolTipText()
          Returns the tool tip to use for the button that cancels the wizard.
protected  int getCloseButtonMnemonic()
          Returns the mnemonic to use for the button that closes the wizard after it has finished.
protected  java.lang.String getCloseButtonText()
          Returns the string to display on the button that closes the wizard after it has finished.
protected  java.lang.String getCloseButtonToolTipText()
          Returns the tool tip to use for the button that closes the wizard after it has finished.
protected  int getFinishButtonMnemonic()
          Returns the mnemonic to use for the button that finishes the wizard.
protected  java.lang.String getFinishButtonText()
          Returns the string to display on the button that finishes the wizard.
protected  java.lang.String getFinishButtonToolTipText()
          Returns the tool tip to use for the button that finishes the wizard.
protected  int getHelpButtonMnemonic()
          Returns the mnemonic to use for the button that provides the user with additional help.
protected  java.lang.String getHelpButtonText()
          Returns the string to display on the button that provides the user with additional help.
protected  java.lang.String getHelpButtonToolTipText()
          Returns the tool tip to use for the button that provides the user with additional help.
protected  int getLastButtonMnemonic()
          Returns the mnemonic to use for the button that skips to the final page of the wizard.
protected  java.lang.String getLastButtonText()
          Returns the string to display on the button that skips to the final page of the wizard.
protected  java.lang.String getLastButtonToolTipText()
          Returns the tool tip to use for the button that skips to the final page of the wizard.
protected  javax.swing.Icon getNextButtonIcon()
          Returns the icon to use for the button that advances the wizard to the next step.
protected  int getNextButtonMnemonic()
          Returns the mnemonic to use for the button that advances the wizard to the next step.
protected  java.lang.String getNextButtonText()
          Returns the string to display on the button that advances the wizard to the next step.
protected  java.lang.String getNextButtonToolTipText()
          Returns the tool tip to use for the button that advances the wizard to the next step.
 java.awt.Dimension getPreferredDialogSize(JWizard wizard)
          Returns the preferred size of the specified wizard when displayed as a dialog .
protected  java.lang.String getStepsTitle()
          Returns the string to display as the title of the list of wizard steps.
 JWizard getWizard()
          Returns the JWizard component that this UI delegate is overseeing.
protected  void installComponents()
          Installs the child components in the wizard component.
protected  void installDefaults()
          Installs the default colors of the wizard component.
protected  void installListeners()
          Installs the look and feel's listeners into the wizard component.
 void installUI(javax.swing.JComponent c)
          Configures the specified component appropriate for the look and feel.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
          Paints the specified component appropriate for the look and feel.
protected  void uninstallComponents()
          Uninstalls the components installed by installComponents.
protected  void uninstallDefaults()
          Uninstalls the defaults installed by installDefaults.
protected  void uninstallListeners()
          Uninstalls the listeners installed by this look and feel object.
 void uninstallUI(javax.swing.JComponent c)
          Reverses configuration which was done on the specified component during installUI.
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCESSORY_PERCENTAGE_KEY

public static final java.lang.Object ACCESSORY_PERCENTAGE_KEY
The look-and-feel key for the ideal percentage the accessory component should be in relation to the entire wizard component. Applications may change the default value by invoking at application start-up
  UIManager.put( BasicWizardUI.ACCESSORY_PERCENTAGE, new Double( 0.33 ));
 


ANCESTOR_INPUT_MAP_KEY

public static final java.lang.Object ANCESTOR_INPUT_MAP_KEY
The look-and-feel key for the ancestor input map.


BACKGROUND_KEY

public static final java.lang.Object BACKGROUND_KEY
The look-and-feel key for the background color. Applications may change the default value by invoking at application start-up
  UIManager.put( BasicWizardUI.BACKGROUND_KEY, Color.blue );
 


DIALOG_PREFERRED_HEIGHT_KEY

public static final java.lang.Object DIALOG_PREFERRED_HEIGHT_KEY
The look-and-feel key for the preferred wizard dialog height. Applications may change the default value by invoking at application start-up
  UIManager.put( BasicWizardUI.DIALOG_PREFERRED_HEIGHT_KEY, new Integer( 300 ));
 


DIALOG_PREFERRED_WIDTH_KEY

public static final java.lang.Object DIALOG_PREFERRED_WIDTH_KEY
The look-and-feel key for the preferred wizard dialog width. Applications may change the default value by invoking at application start-up
  UIManager.put( BasicWizardUI.DIALOG_PREFERRED_WIDTH_KEY, new Integer( 500 ));
 


FOREGROUND_KEY

public static final java.lang.Object FOREGROUND_KEY
The look-and-feel key for the foreground color. Applications may change the default value by invoking at application start-up
  UIManager.put( BasicWizardUI.FOREGROUND_KEY, Color.blue );
 


FONT_KEY

public static final java.lang.Object FONT_KEY
The look-and-feel key for the font. Applications may change the default value by invoking at application start-up
  Font customFont = ...
  UIManager.put( BasicWizardUI.FONT_KEY, customFont );
 


STEPS_BACKGROUND_KEY

public static final java.lang.Object STEPS_BACKGROUND_KEY
The look-and-feel key for the background color of the accessory panel that shows the list of wizard steps. Applications may change the default value by invoking at application start-up
  UIManager.put( BasicWizardUI.STEPS_BACKGROUND_KEY, Color.blue );
 


TITLE_FONT_KEY

public static final java.lang.Object TITLE_FONT_KEY
The look-and-feel key for the title font. Applications may change the default value by invoking at application start-up
  Font customFont = ...
  UIManager.put( BasicWizardUI.TITLE_FONT_KEY, customFont );
 

Constructor Detail

BasicWizardUI

public BasicWizardUI()
Method Detail

createBackAction

protected javax.swing.Action createBackAction()
Creates and returns an action for the Back button.

Returns:
an action that will step the wizard back a page
See Also:
JWizard.doBack()

createCancelAction

protected javax.swing.Action createCancelAction()
Creates and returns an action for the Cacnel button.

Returns:
an action that will cancel the wizard
See Also:
JWizard.doCancel()

createCloseAction

protected javax.swing.Action createCloseAction()
Creates and returns an action for the Close button.

Returns:
an action that will close the wizard after it has finished
See Also:
JWizard.doClose()

createFinishAction

protected javax.swing.Action createFinishAction()
Creates and returns an action for the Finish button.

Returns:
an action that will finish the wizard
See Also:
JWizard.doFinish()

createHelpAction

protected javax.swing.Action createHelpAction()
Creates and returns an action for the Help button.

Returns:
an action that will invoke the wizard's additional help
See Also:
JWizard.doHelp()

createLastAction

protected javax.swing.Action createLastAction()
Creates and returns an action for the Last button.

Returns:
an action that will advance the wizard to its last page
See Also:
JWizard.doLast()

createNextAction

protected javax.swing.Action createNextAction()
Creates and returns an action for the Next button.

Returns:
an action that will advance the wizard to the next page
See Also:
JWizard.doNext()

createPropertyChangeListener

protected java.beans.PropertyChangeListener createPropertyChangeListener()
Creates and returns the property change listener that will respond to changes in the JWizard.

Returns:
the property change listener that will respond to wizard changes

getBackButtonIcon

protected javax.swing.Icon getBackButtonIcon()
Returns the icon to use for the button that returns the wizard to the previous step.

Returns:
the icon of the Back button

getBackButtonText

protected java.lang.String getBackButtonText()
Returns the string to display on the button that returns the wizard to the previous step.

Returns:
the text on the Back button

getBackButtonToolTipText

protected java.lang.String getBackButtonToolTipText()
Returns the tool tip to use for the button that returns the wizard to the previous step.

Returns:
the tool tip for the Back button

getBackButtonMnemonic

protected int getBackButtonMnemonic()
Returns the mnemonic to use for the button that returns the wizard to the previous step.

Returns:
the mnemonic for the Back button

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
Returns an instance of the UI delegate for the specified component.


getCancelButtonText

protected java.lang.String getCancelButtonText()
Returns the string to display on the button that cancels the wizard.

Returns:
the text on the Cancel button

getCancelButtonToolTipText

protected java.lang.String getCancelButtonToolTipText()
Returns the tool tip to use for the button that cancels the wizard.

Returns:
the tool tip for the Cancel button

getCloseButtonText

protected java.lang.String getCloseButtonText()
Returns the string to display on the button that closes the wizard after it has finished.

Returns:
the text on the Close button

getCloseButtonToolTipText

protected java.lang.String getCloseButtonToolTipText()
Returns the tool tip to use for the button that closes the wizard after it has finished.

Returns:
the tool tip for the Close button

getCloseButtonMnemonic

protected int getCloseButtonMnemonic()
Returns the mnemonic to use for the button that closes the wizard after it has finished.

Returns:
the mnemonic for the Close button

getFinishButtonText

protected java.lang.String getFinishButtonText()
Returns the string to display on the button that finishes the wizard.

Returns:
the text on the Finish button

getFinishButtonToolTipText

protected java.lang.String getFinishButtonToolTipText()
Returns the tool tip to use for the button that finishes the wizard.

Returns:
the tool tip for the Finish button

getFinishButtonMnemonic

protected int getFinishButtonMnemonic()
Returns the mnemonic to use for the button that finishes the wizard.

Returns:
the mnemonic for the Finish button

getHelpButtonText

protected java.lang.String getHelpButtonText()
Returns the string to display on the button that provides the user with additional help.

Returns:
the text on the Help button

getHelpButtonToolTipText

protected java.lang.String getHelpButtonToolTipText()
Returns the tool tip to use for the button that provides the user with additional help.

Returns:
the tool tip for the Help button

getHelpButtonMnemonic

protected int getHelpButtonMnemonic()
Returns the mnemonic to use for the button that provides the user with additional help.

Returns:
the mnemonic for the Help button

getLastButtonText

protected java.lang.String getLastButtonText()
Returns the string to display on the button that skips to the final page of the wizard.

Returns:
the text on the Last button

getLastButtonToolTipText

protected java.lang.String getLastButtonToolTipText()
Returns the tool tip to use for the button that skips to the final page of the wizard.

Returns:
the tool tip for the Last button

getLastButtonMnemonic

protected int getLastButtonMnemonic()
Returns the mnemonic to use for the button that skips to the final page of the wizard.

Returns:
the mnemonic for the Last button

getNextButtonIcon

protected javax.swing.Icon getNextButtonIcon()
Returns the icon to use for the button that advances the wizard to the next step.

Returns:
the icon of the Next button

getNextButtonText

protected java.lang.String getNextButtonText()
Returns the string to display on the button that advances the wizard to the next step.

Returns:
the text on the Next button

getNextButtonToolTipText

protected java.lang.String getNextButtonToolTipText()
Returns the tool tip to use for the button that advances the wizard to the next step.

Returns:
the tool tip for the Next button

getNextButtonMnemonic

protected int getNextButtonMnemonic()
Returns the mnemonic to use for the button that advances the wizard to the next step.

Returns:
the mnemonic for the Next button

getPreferredDialogSize

public java.awt.Dimension getPreferredDialogSize(JWizard wizard)
Description copied from class: WizardUI
Returns the preferred size of the specified wizard when displayed as a dialog .

Specified by:
getPreferredDialogSize in class WizardUI
Parameters:
wizard - component for which the preferred dialog size is requested
Returns:
the preferred size of the specified wizard when displayed as a dialog

getStepsTitle

protected java.lang.String getStepsTitle()
Returns the string to display as the title of the list of wizard steps.

Returns:
the header for the list of steps

getWizard

public JWizard getWizard()
Returns the JWizard component that this UI delegate is overseeing.

Returns:
the JWizard component that this UI delegate is overseeing.


installComponents

protected void installComponents()
Installs the child components in the wizard component.


installDefaults

protected void installDefaults()
Installs the default colors of the wizard component.

See Also:
uninstallDefaults()

installListeners

protected void installListeners()
Installs the look and feel's listeners into the wizard component.


installUI

public void installUI(javax.swing.JComponent c)
Configures the specified component appropriate for the look and feel.

Overrides:
installUI in class javax.swing.plaf.ComponentUI
See Also:
uninstallUI(javax.swing.JComponent)

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Paints the specified component appropriate for the look and feel. This method is invoked from the ComponentUI.update method when the specified component is being painted. Subclasses should override this method and use the specified Graphics object to render the content of the component.

Overrides:
paint in class javax.swing.plaf.ComponentUI
Parameters:
g - the Graphics context in which to paint
c - the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components
See Also:
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)

uninstallComponents

protected void uninstallComponents()
Uninstalls the components installed by installComponents.

See Also:
installComponents()

uninstallDefaults

protected void uninstallDefaults()
Uninstalls the defaults installed by installDefaults.

See Also:
installDefaults()

uninstallListeners

protected void uninstallListeners()
Uninstalls the listeners installed by this look and feel object.

See Also:
installListeners()

uninstallUI

public void uninstallUI(javax.swing.JComponent c)
Reverses configuration which was done on the specified component during installUI.

Overrides:
uninstallUI in class javax.swing.plaf.ComponentUI
See Also:
installUI(javax.swing.JComponent)

Side of Software
Wizard Library 1.6

Copyright 2004-07 Side of Software (SOS). All rights reserved.