JIDE 3.5.15

com.jidesoft.status
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 com.jidesoft.status.StatusBar
All Implemented Interfaces:
ComponentListener, ContainerListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
CodeEditorStatusBar

public class StatusBar
extends JPanel
implements ComponentListener, ContainerListener

A custom status bar component.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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()
          Default constructor.
 
Method Summary
 void add(Component comp, Object constraints)
           
protected  void addExtraSeparator()
           
protected  void addImpl(Component comp, Object constraints, int index)
           
 void addSeparator()
          Adds a separator.
 void componentAdded(ContainerEvent e)
          Invoked when a component has been added to the container.
 void componentHidden(ComponentEvent e)
           
 void componentMoved(ComponentEvent e)
           
 void componentRemoved(ContainerEvent e)
          Invoked when a component has been removed from the container.
 void componentResized(ComponentEvent e)
           
 void componentShown(ComponentEvent e)
           
protected  StatusBarSeparator createStatusBarSeparator()
          Creates the status bar separator.
 StatusBarItem getItemByName(String name)
          Gets status bar item by its name.
 int getPreferredHeight()
          Returns the current height of this component.
 Dimension getPreferredSize()
          If the preferredSize has been set to a non-null value just returns it.
 boolean isAutoAddSeparator()
          Checks if a separator will be added automatically when a new status bar item is added.
 boolean isChildrenOpaque()
          Checks if the children should be opaque.
protected  void paintComponent(Graphics g)
           
 void remove(int index)
           
 void remove(String name)
          Removes the status bar item by name.
protected  boolean removeExtraSeparator()
           
 void resetToPreferredSizes()
          Lays out the JideSplitPane layout based on the preferred size of the children components.
 void setAutoAddSeparator(boolean autoAddSeparator)
          Sets the value of autoAddSeparator.
 void setChildrenOpaque(boolean childrenOpaque)
          Sets the opaque attribute of status bar items.
 void setItemVisible(String name, boolean visible)
          Sets the visibility of status bar item.
 void updateUI()
          Resets the UI property with a value from the current look and feel.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
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, 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, 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, processContainerEvent, processEvent, 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

StatusBar

public StatusBar()
Default constructor.

Method Detail

addImpl

protected void addImpl(Component comp,
                       Object constraints,
                       int index)
Overrides:
addImpl in class Container

remove

public void remove(int index)
Overrides:
remove in class Container

add

public void add(Component comp,
                Object constraints)
Overrides:
add in class Container

remove

public void remove(String name)
Removes the status bar item by name. Nothing will be removed if there is no status bar item that has the name.

Parameters:
name - the name of the status bar item to be removed.

isAutoAddSeparator

public boolean isAutoAddSeparator()
Checks if a separator will be added automatically when a new status bar item is added.

Returns:
true or false.

setAutoAddSeparator

public void setAutoAddSeparator(boolean autoAddSeparator)
Sets the value of autoAddSeparator. By default it's true which means a separator is added automatically between two status bar items. You can set it to false to turn it off. In this case, you can manually add separators.

Parameters:
autoAddSeparator - true or false.

componentAdded

public void componentAdded(ContainerEvent e)
Invoked when a component has been added to the container. Basically if you add anything which is not divider, a divider will automatically added before or after the component.

Specified by:
componentAdded in interface ContainerListener
Parameters:
e - ContainerEvent

componentRemoved

public void componentRemoved(ContainerEvent e)
Invoked when a component has been removed from the container. Basically if you remove anything which is not divider, a divider will automatically deleted before or after the component.

Specified by:
componentRemoved in interface ContainerListener
Parameters:
e - ContainerEvent

componentResized

public void componentResized(ComponentEvent e)
Specified by:
componentResized in interface ComponentListener

componentMoved

public void componentMoved(ComponentEvent e)
Specified by:
componentMoved in interface ComponentListener

componentShown

public void componentShown(ComponentEvent e)
Specified by:
componentShown in interface ComponentListener

resetToPreferredSizes

public void resetToPreferredSizes()
Lays out the JideSplitPane layout based on the preferred size of the children components. This will likely result in changing the divider location.


componentHidden

public void componentHidden(ComponentEvent e)
Specified by:
componentHidden in interface ComponentListener

removeExtraSeparator

protected boolean removeExtraSeparator()

addExtraSeparator

protected void addExtraSeparator()

createStatusBarSeparator

protected StatusBarSeparator createStatusBarSeparator()
Creates the status bar separator.

Returns:
a status bar separator.

addSeparator

public void addSeparator()
Adds a separator. If isAutoAddSeparator() is true, you don't need to add separator manually because a separator will be added automatically between two status bar items. Only when it's false, you need to add separator manually using this method.


updateUI

public void updateUI()
Resets the UI property with a value from the current look and feel.

Overrides:
updateUI in class JPanel
See Also:
JComponent.updateUI()

getItemByName

public StatusBarItem getItemByName(String name)
Gets status bar item by its name.

Parameters:
name - item name
Returns:
item with the name

getPreferredHeight

public int getPreferredHeight()
Returns the current height of this component. This method is preferable to writing component.getBounds().height, or component.getSize().height because it doesn't cause any heap allocations.

Returns:
the current height of this component

getPreferredSize

public Dimension getPreferredSize()
If the preferredSize has been set to a non-null value just returns it. If the UI delegate's getPreferredSize method returns a non null value then return that; otherwise defer to the component's layout manager.

Overrides:
getPreferredSize in class JComponent
Returns:
the value of the preferredSize property
See Also:
JComponent.setPreferredSize(java.awt.Dimension), ComponentUI

setItemVisible

public void setItemVisible(String name,
                           boolean visible)
Sets the visibility of status bar item.

Parameters:
name - the name of the status bar item.
visible - true or false

paintComponent

protected void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent

isChildrenOpaque

public boolean isChildrenOpaque()
Checks if the children should be opaque.

Returns:
true if children should be opaque.

setChildrenOpaque

public void setChildrenOpaque(boolean childrenOpaque)
Sets the opaque attribute of status bar items. Please call this method before adding any status bar item to the status bar.

Parameters:
childrenOpaque - true or false.

JIDE 3.5.15