kiwi.ui
Class StatusBar

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bykiwi.ui.KPanel
                      extended bykiwi.ui.StatusBar
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, ProgressObserver, java.io.Serializable

public class StatusBar
extends KPanel
implements ProgressObserver, java.awt.event.ActionListener

This class represents a status bar that includes a message area and an optional progress meter (see Thermometer). Status bars are typically placed at the bottom of an application window. Status messages disappear after a fixed number of seconds, unless they are specified as non-expiring; the delay is adjustable.


An example StatusBar.

Author:
Mark Lindner, PING Software Group
See Also:
Thermometer, Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private static javax.swing.border.Border border
           
private  boolean busy
           
private  java.awt.GridBagConstraints gbc
           
private static java.awt.Insets insets
           
private  javax.swing.JTextField label
           
private  boolean labelOnly
           
private  Thermometer meter
           
private  javax.swing.Timer timer
           
 
Fields inherited from class kiwi.ui.KPanel
 
Fields inherited from class javax.swing.JPanel
 
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.Container
 
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
StatusBar()
          Construct a new StatusBar.
StatusBar(boolean showMeter)
          Construct a new StatusBar.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          This method is public as an implementation side-effect.
 void addStatusComponent(javax.swing.JComponent c)
          Add a component to the status bar.
 boolean isBusy()
          Determine if the meter slider is currently active.
 void removeStatusComponent(javax.swing.JComponent c)
          Remove a component from the status bar.
 void setBusy(boolean flag)
          Start or stop the slider.
 void setDelay(int seconds)
          Set the delay on status bar messages.
 void setFont(java.awt.Font font)
          Set the message font.
 void setMeterColor(java.awt.Color color)
          Set the meter color.
 void setProgress(int percent)
          Set a percentage on the meter.
 void setText(java.lang.String text)
          Set the text to be displayed in the status bar.
 void setText(java.lang.String text, boolean expires)
          Set the text to be displayed in the status bar.
 void setTextColor(java.awt.Color color)
          Set the text color.
 
Methods inherited from class kiwi.ui.KPanel
getComponentByName, paintComponent, setFocusOrder, setTexture
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

label

private javax.swing.JTextField label

meter

private Thermometer meter

labelOnly

private boolean labelOnly

border

private static final javax.swing.border.Border border

timer

private javax.swing.Timer timer

gbc

private java.awt.GridBagConstraints gbc

busy

private boolean busy

insets

private static final java.awt.Insets insets
Constructor Detail

StatusBar

public StatusBar()
Construct a new StatusBar. Constructs a new status bar without a progress meter.


StatusBar

public StatusBar(boolean showMeter)
Construct a new StatusBar.

Parameters:
showMeter - A flag specifying whether the status bar should include a progress meter.
Method Detail

removeStatusComponent

public void removeStatusComponent(javax.swing.JComponent c)
Remove a component from the status bar. The specified component will be removed from the status bar. The text status field and the progress meter (if present) cannot be removed.

Parameters:
c - The component to remove.
Throws:
java.lang.IllegalArgumentException - If an attempt was made to remove the text status field or tje progress meter.

addStatusComponent

public void addStatusComponent(javax.swing.JComponent c)
Add a component to the status bar. The new component will be fitted with a beveled border and made transparent to match the other components in the status bar, and will be added at the right end of the status bar.

Parameters:
c - The component to add.

setBusy

public void setBusy(boolean flag)
Start or stop the slider. Starts or stops the progress meter's slider. If this status bar was created without a progress meter, this method will have no effect.

Parameters:
flag - A flag specifying whether the slider should be started or stopped.

isBusy

public boolean isBusy()
Determine if the meter slider is currently active.

Returns:
true if the slider is active, and false otherwise.

setFont

public void setFont(java.awt.Font font)
Set the message font. Sets the font for the text in the status bar.

Parameters:
font - The new font.

setTextColor

public void setTextColor(java.awt.Color color)
Set the text color. Sets the color of the text displayed in the status bar.

Parameters:
color - The text new color.

setMeterColor

public void setMeterColor(java.awt.Color color)
Set the meter color.

Parameters:
color - The new forground color for the thermometer.

setProgress

public void setProgress(int percent)
Set a percentage on the meter. The percent value, which must be between 0 and 100 inclusive, specifies how much of the meter should be filled in with the foreground color.

Specified by:
setProgress in interface ProgressObserver
Parameters:
percent - The percentage, a value between 0 and 100 inclusive. If the value is out of range, it is clipped.

setText

public void setText(java.lang.String text)
Set the text to be displayed in the status bar. The status bar will be cleared when the delay expires.

Parameters:
text - The text to display in the status bar.

setText

public void setText(java.lang.String text,
                    boolean expires)
Set the text to be displayed in the status bar.

Parameters:
text - The text to display in the status bar.
expires - A flag specifying whether the message "expires." If true, the status bar will be cleared after the message has been in the status bar for a specified number of seconds. The default delay is 10 seconds, but can be adjusted via the setDelay() method.
See Also:
setDelay(int)

setDelay

public void setDelay(int seconds)
Set the delay on status bar messages.

Parameters:
seconds - The number of seconds before a message disappears from the status bar.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
This method is public as an implementation side-effect.

Specified by:
actionPerformed in interface java.awt.event.ActionListener