net.wotonomy.ui.swing.components
Class CheckButtonPanel

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 net.wotonomy.ui.swing.components.ButtonPanel
                      extended by net.wotonomy.ui.swing.components.CheckButtonPanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class CheckButtonPanel
extends ButtonPanel

CheckButtonPanel is a simple extension of ButtonPanel. Differences are that it uses JCheckBoxes and the default alignment is vertical. The panel defaults to having no buttons selected.

Version:
$Revision: 904 $
Author:
michael@mpowers.net, $Author: cgruber $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class net.wotonomy.ui.swing.components.ButtonPanel
ButtonPanel.ActionChangeListener
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class net.wotonomy.ui.swing.components.ButtonPanel
actionListener, ADD, buttonContainer, buttonList, buttonPanelLayout, CANCEL, CLEAR_ALL, insets, NO, OK, REFRESH, REMOVE, SAVE, STATE_CHANGED, YES
 
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
CheckButtonPanel()
          Constructs a CheckButtonPanel.
CheckButtonPanel(java.lang.String[] buttonList)
          Constructs a ButtonPanel using specified buttons.
 
Method Summary
 void checkAll()
          Convenience method to check all boxes on the panel.
 void clearAll()
          Convenience method to clear all boxes on the panel.
protected  java.awt.Component createComponentWithLabel(java.lang.String aLabel)
          Overridden to return a JRadioButton.
 java.util.List getCheckedValueList()
          Gets the labels of all checkboxes that are checked.
 java.lang.String[] getCheckedValues()
          Gets the labels of all checkboxes that are checked.
 boolean getValue(java.lang.String aName)
          Gets the value of the specified button.
protected  void initLayout()
          Overridden to set vertical-center alignment and zero vgap.
static void main(java.lang.String[] argv)
           
 void setAllValues(boolean aValue)
          Convenience method to set all checkboxes on the panel.
 void setCheckedValues(java.lang.String[] aLabelArray)
          A convenience method to set only those buttons on the entire panel that should be checked.
 void setValue(java.lang.String aName, boolean aValue)
          Sets the value of the button whose name matches the given text value.
 void setValues(java.lang.String[] aLabelArray, boolean aValue)
          Sets the state of the specified buttons to the specified value.
 
Methods inherited from class net.wotonomy.ui.swing.components.ButtonPanel
actionPerformed, addActionListener, addComponentToPanel, broadcastEvent, getAlignment, getButton, getHgap, getInsets, getLabels, getVgap, mouseDragged, mouseMoved, removeActionListener, setAlignment, setEnabled, setHgap, setInsets, setLabels, setLabels, setVgap
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, 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, 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, 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

CheckButtonPanel

public CheckButtonPanel()
Constructs a CheckButtonPanel. Three buttons are created so the panel is filled when used in a GUI-builder environment.


CheckButtonPanel

public CheckButtonPanel(java.lang.String[] buttonList)
Constructs a ButtonPanel using specified buttons.

Parameters:
buttonList - An array containing the strings to be used in labeling the buttons.
Method Detail

initLayout

protected void initLayout()
Overridden to set vertical-center alignment and zero vgap.

Overrides:
initLayout in class ButtonPanel

createComponentWithLabel

protected java.awt.Component createComponentWithLabel(java.lang.String aLabel)
Overridden to return a JRadioButton.

Overrides:
createComponentWithLabel in class ButtonPanel
Parameters:
aLabel - The label for the component that will be created.
Returns:
The newly created component.

setValue

public void setValue(java.lang.String aName,
                     boolean aValue)
Sets the value of the button whose name matches the given text value.

Parameters:
aName - A String matching the name of one of the buttons. If null, empty, or not matching, nothing happens.
aValue - A value to set the button.

setValues

public void setValues(java.lang.String[] aLabelArray,
                      boolean aValue)
Sets the state of the specified buttons to the specified value.

Parameters:
aLabelArray - An Array of Strings listing the buttons to be set.
aValue - The value to which the specified buttons will be set.

setAllValues

public void setAllValues(boolean aValue)
Convenience method to set all checkboxes on the panel.

Parameters:
aValue - The value to which all checkboxes on the panel will be set.

checkAll

public void checkAll()
Convenience method to check all boxes on the panel.


clearAll

public void clearAll()
Convenience method to clear all boxes on the panel.


setCheckedValues

public void setCheckedValues(java.lang.String[] aLabelArray)
A convenience method to set only those buttons on the entire panel that should be checked. Buttons not in the list are unchecked.

Parameters:
aLabelArray - An Array of Strings listing the buttons to be set.

getCheckedValueList

public java.util.List getCheckedValueList()
Gets the labels of all checkboxes that are checked.

Returns:
A List of Strings containing the labels of the boxes that are checked.

getCheckedValues

public java.lang.String[] getCheckedValues()
Gets the labels of all checkboxes that are checked.

Returns:
A String Array containing the labels of the boxes that are checked.

getValue

public boolean getValue(java.lang.String aName)
Gets the value of the specified button.

Parameters:
aName - A String matching the name of one of the buttons.
Returns:
True if the button is checked, False if it is not checked. NOTE: If the button is not found in the list, False is returned.

main

public static void main(java.lang.String[] argv)


Copyright © 2006 null. All Rights Reserved.