org.fife.ui
Class StatusBar

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 org.fife.ui.StatusBarPanel
                      extended by org.fife.ui.StatusBar
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
StatusBar

public class StatusBar
extends StatusBarPanel
implements java.awt.event.MouseListener

A generic status bar containing a status message and a size grip, similar to those found in Microsoft Windows applications.

This component can be used as-is, or can be subclassed and have additional components added to it. If the latter, the user MUST add instances of StatusBarPanel and they MUST be added via the addStatusBarComponent methods; if you instead use one of Container's add methods, there is no guarantee as to the flow/layout of the status bar.

Version:
0.7
Author:
Robert Futrell
See Also:
Serialized Form

Nested Class Summary
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.lang.String DEFAULT_STATUS_MESSAGE
           
static java.lang.String STYLE_PROPERTY
           
static int WINDOWS_98_STYLE
           
static int WINDOWS_XP_STYLE
           
 
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
StatusBar()
          Creates the status bar with a default status message and a size grip.
StatusBar(java.lang.String defaultStatusMessage)
          Creates the status bar with the specified default message and a size grip.
StatusBar(java.lang.String defaultStatusMessage, int style)
          Creates the status bar.
 
Method Summary
 void addStatusBarComponent(StatusBarPanel panel, java.awt.GridBagConstraints constraints)
          Adds a component to the end of this status bar (but before the size grip).
 void addStatusBarComponent(StatusBarPanel panel, int index, java.awt.GridBagConstraints constraints)
          Adds a component to this status bar.
 void applyComponentOrientation(java.awt.ComponentOrientation o)
          Overridden to ensure that the slight border between the status text and the edge of the status bar is on the correct side of the status bar, depending on whether we're LTR or RTL.
 java.lang.String getDefaultStatusMessage()
          Returns the default message displayed by this status bar.
 java.lang.String getStatusMessage()
          Returns the message in the status bar.
 int getStyle()
          Returns the "style" used to paint this status bar.
 void mouseClicked(java.awt.event.MouseEvent e)
          Called whenever the mouse is clicked in a component listened to by this status bar.
 void mouseEntered(java.awt.event.MouseEvent e)
          Called whenever the mouse enters a component listened to by this status bar.
 void mouseExited(java.awt.event.MouseEvent e)
          Called whenever the mouse exits in a component listened to by this status bar.
 void mousePressed(java.awt.event.MouseEvent e)
          Called whenever the mouse is pressed in a component listened to by this status bar.
 void mouseReleased(java.awt.event.MouseEvent e)
          Called whenever the mouse is released in a component listened to by this status bar.
 void setStatusMessage(java.lang.String newMessage)
          Setter function for message in the status bar.
 void setStyle(int style)
          Sets the "style" used for this status bar.
 
Methods inherited from class org.fife.ui.StatusBarPanel
isShadowEnabled, paintComponent, setShadowEnabled
 
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, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, paintBorder, paintChildren, 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, setEnabled, 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, 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

STYLE_PROPERTY

public static final java.lang.String STYLE_PROPERTY
See Also:
Constant Field Values

WINDOWS_98_STYLE

public static final int WINDOWS_98_STYLE
See Also:
Constant Field Values

WINDOWS_XP_STYLE

public static final int WINDOWS_XP_STYLE
See Also:
Constant Field Values

DEFAULT_STATUS_MESSAGE

public static final java.lang.String DEFAULT_STATUS_MESSAGE
See Also:
Constant Field Values
Constructor Detail

StatusBar

public StatusBar()
Creates the status bar with a default status message and a size grip.


StatusBar

public StatusBar(java.lang.String defaultStatusMessage)
Creates the status bar with the specified default message and a size grip.

Parameters:
defaultStatusMessage - The default message to display.

StatusBar

public StatusBar(java.lang.String defaultStatusMessage,
                 int style)
Creates the status bar.

Parameters:
defaultStatusMessage - The default message to display.
style - The style with which to paint the status bar.
Method Detail

addStatusBarComponent

public void addStatusBarComponent(StatusBarPanel panel,
                                  int index,
                                  java.awt.GridBagConstraints constraints)
Adds a component to this status bar.

Parameters:
panel - The panel to add.
index - The index at which to place this component. A value of 0 means "right after the status message."
constraints - The constraints with which to add the panel.

addStatusBarComponent

public void addStatusBarComponent(StatusBarPanel panel,
                                  java.awt.GridBagConstraints constraints)
Adds a component to the end of this status bar (but before the size grip). This is the preferred method of adding components.

Parameters:
panel - The panel to add.
constraints - The constraints with which to add the panel.

applyComponentOrientation

public void applyComponentOrientation(java.awt.ComponentOrientation o)
Overridden to ensure that the slight border between the status text and the edge of the status bar is on the correct side of the status bar, depending on whether we're LTR or RTL.

Overrides:
applyComponentOrientation in class java.awt.Container
Parameters:
o - The new orientation.

getDefaultStatusMessage

public java.lang.String getDefaultStatusMessage()
Returns the default message displayed by this status bar.

Returns:
The default message.

getStatusMessage

public java.lang.String getStatusMessage()
Returns the message in the status bar.

Returns:
The message in the status bar.
See Also:
setStatusMessage(java.lang.String)

getStyle

public int getStyle()
Returns the "style" used to paint this status bar.

Returns:
The style of this status bar, such as WINDOWS_XP_STYLE.
See Also:
setStyle(int)

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Called whenever the mouse is clicked in a component listened to by this status bar. This method should not be overridden.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - The mouse event.

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Called whenever the mouse enters a component listened to by this status bar. This method should not be overridden.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - The mouse event.

mouseExited

public final void mouseExited(java.awt.event.MouseEvent e)
Called whenever the mouse exits in a component listened to by this status bar. This method should not be overridden.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - The mouse event.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Called whenever the mouse is pressed in a component listened to by this status bar. This method should not be overridden.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - The mouse event.

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Called whenever the mouse is released in a component listened to by this status bar. This method should not be overridden.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - The mouse event.

setStatusMessage

public void setStatusMessage(java.lang.String newMessage)
Setter function for message in the status bar.

Parameters:
newMessage - The new message to display.
See Also:
getStatusMessage()

setStyle

public void setStyle(int style)
Sets the "style" used for this status bar. This method fires a property change event of type STYLE_PROPERTY.

Parameters:
style - The style to use. If this value is invalid, WINDOWS_98_STYLE is used.
See Also:
getStyle()