com.quadrique.jbuildingblocks.gui
Class ButtonArea

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 com.quadrique.jbuildingblocks.gui.ButtonAreaBase
                      extended by com.quadrique.jbuildingblocks.gui.ButtonArea
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class ButtonArea
extends ButtonAreaBase

This class implements a generic horizontal or vertical buttons area. It is typically used for the button area of dialogs...

Author:
Hervé Rivere
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
ButtonArea(boolean zIsHorizontal, boolean zIsCentered)
          constructor
 
Method Summary
 JButton addButton(ActionBase zAction, int zButtonId)
          This method adds a button to the button area.
 void addButton(JButton zButton, int zButtonId)
          This method adds a button to the ButtonArea
 JButton addButton(String zLabel, int zMnemonic, String zToolTip, ImageIcon zIcon, int zButtonId)
          This method adds a button to the ButtonArea
 void addEmptySpace(int zNbOfPixels)
          add a fixed size empty space to the panel (e.g.
 
Methods inherited from class com.quadrique.jbuildingblocks.gui.ButtonAreaBase
actionPerformed, addButtonSelectedEventListener, getButton, getNbOfButtons, removeButtonSelectedEventListener, setEnabled
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ButtonArea

public ButtonArea(boolean zIsHorizontal,
                  boolean zIsCentered)
constructor

Parameters:
zIsHorizontal - true is the button area is horizontal, false if it is vertical
zIsCentered - if true, the buttons are centered accross the full button area (i.e. the space between any two consecutive buttons is the same).
If false, the buttons are aligned to the right (if horizontal) or to the top (if vertical) with a fixed 5 pixels (see Java Look&Feel Guidelines) interval between two consecutive buttons.
Method Detail

addButton

public JButton addButton(String zLabel,
                         int zMnemonic,
                         String zToolTip,
                         ImageIcon zIcon,
                         int zButtonId)
This method adds a button to the ButtonArea

Parameters:
zLabel - the label that is used for the button,
zMnemonic - the menmonic to use for the button (e.g. KeyEvent.VK_P)
zToolTip - the tooltip string that is used for the button,
zIcon - an optional icon (use null if you don't want an icon)
zButtonId - the identifier of the button (must be unique, this routine does not check for identifier uniqueness). The button identifier is used to determine which button has been selected or to specify which button you want to access (e.g. to set the focus or to enable/disable a specific button).
Returns:
the JButton instance that has been created for this button

addButton

public void addButton(JButton zButton,
                      int zButtonId)
This method adds a button to the ButtonArea

Overrides:
addButton in class ButtonAreaBase
Parameters:
zButton - the button to add
zButtonId - the identifier of the button (must be unique, this routine does not check for identifier uniqueness). The button identifier is used to determine which button has been selected or to specify which button you want to access (e.g. to set the focus or to enable/disable a specific button).

addButton

public JButton addButton(ActionBase zAction,
                         int zButtonId)
This method adds a button to the button area. The button is associated to the given action and as such, there will not be any ButtonAreaEvent send to the listener(s) when the button is activated

Parameters:
zAction - the ActionBase instance to use for the new button
zButtonId - the identifier of the button (must be unique, this routine does not check for identifier uniqueness). The button identifier is used to determine which button has been selected or to specify which button you want to access (e.g. to set the focus or to enable/disable a specific button).
Returns:
the JButton instance that has been created for this button

addEmptySpace

public void addEmptySpace(int zNbOfPixels)
add a fixed size empty space to the panel (e.g. in a wizard, you need to separate a set of buttons from the others)

Parameters:
zNbOfPixels - the number of pixels to use for the space


Copyright © 2001-2009 Quadrique Corporation. All Rights Reserved.