net.wotonomy.ui.swing.components
Class StatusButtonPanel

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.StatusButtonPanel
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 StatusButtonPanel
extends ButtonPanel

StatusButtonPanel extends ButtonPanel to provide a space to display status messages in a consistent manner.

Messages are erased after a certain predefined interval, defaulting to 10 seconds.

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
protected  int interval
           
static java.lang.String STATUS_CHANGED
          This is the action command to all listeners when the status text is changed.
protected  java.awt.Component statusComponent
           
protected  javax.swing.Timer timer
           
 
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
StatusButtonPanel()
          Constructs a StatusButtonPanel.
StatusButtonPanel(java.lang.String[] buttonList)
          Constructs a StatusButtonPanel using specified buttons.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Receives ActionEvents from the internal timer.
 int getDelayInterval()
          Returns the number of milliseconds before the status message is cleared.
 java.awt.Component getStatusComponent()
          Returns the visual component used to display the status.
 java.lang.String getText()
          Gets the text in the status area.
protected  void initLayout()
          This method is responsible for the initial layout of the panel.
static void main(java.lang.String[] argv)
           
 void setDelayInterval(int millis)
          Sets the number of milliseconds before the status message is cleared.
 void setText(java.lang.String newText)
          Sets the text to appear in the status area.
protected  void setupTimer()
          Initializes the timer instance variable.
 
Methods inherited from class net.wotonomy.ui.swing.components.ButtonPanel
addActionListener, addComponentToPanel, broadcastEvent, createComponentWithLabel, 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
 

Field Detail

STATUS_CHANGED

public static final java.lang.String STATUS_CHANGED
This is the action command to all listeners when the status text is changed.

See Also:
Constant Field Values

statusComponent

protected java.awt.Component statusComponent

timer

protected javax.swing.Timer timer

interval

protected int interval
Constructor Detail

StatusButtonPanel

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


StatusButtonPanel

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

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

setupTimer

protected void setupTimer()
Initializes the timer instance variable.


getDelayInterval

public int getDelayInterval()
Returns the number of milliseconds before the status message is cleared. The default is 10000.

Returns:
The current delay interval in milliseconds.

setDelayInterval

public void setDelayInterval(int millis)
Sets the number of milliseconds before the status message is cleared.

Parameters:
millis - The new delay interval in milliseconds.

getStatusComponent

public java.awt.Component getStatusComponent()
Returns the visual component used to display the status.

Returns:
A component used for displaying status.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Receives ActionEvents from the internal timer.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Overrides:
actionPerformed in class ButtonPanel
Parameters:
e - The action event in question.

initLayout

protected void initLayout()
This method is responsible for the initial layout of the panel. Subclasses can implement different layouts, but this method is responsible for initializing buttonPanelLayout to a valid layout manager and setting this panel to use it. This method must should initialize statusComponent to a component that ideally has get/setText methods, although this is not required.

Overrides:
initLayout in class ButtonPanel

setText

public void setText(java.lang.String newText)
Sets the text to appear in the status area.

Parameters:
newText - A string to appear in the status area. Nulls are allowed.

getText

public java.lang.String getText()
Gets the text in the status area.

Returns:
The string being displayed in the status area.

main

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


Copyright © 2006 null. All Rights Reserved.