com.sygem.swing.joutlooknavbar
Class NavBarItem

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JLabel
                  extended bycom.sygem.swing.joutlooknavbar.NavBarItem
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants

public class NavBarItem
extends javax.swing.JLabel

Class representing a single category item.

The appearance of the item is controlled using the State class. Each item has three states:

Title: JOutlookNavBar
Description: A Swing component simulating Outlook's Nav Bar
Copyright: Copyright (c) 2004
Company: SyGem Software

Version:
1.2c
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
NavBarItem(java.lang.String title)
          Creates a new NavBarItem with the specified title.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener listener)
          Adds an ActionListener to this item.
 BackgroundRenderer getBackgroundRenderer()
          Returns the renderer currently being used for this item.
 State getItemSelectedState()
          Returns the State representing the item's appearance when selected.
 State getMouseNotOverState()
          Returns the State representing the item's appearance when tje mouse is not over it, and it is not selected.
 State getMouseOverState()
          Returns the State representing the item's appearance when the mouse is over it, and it is not selected.
 boolean isSelected()
          Returns TRUE if this NavBarItem is currently selected.
 void removeActionListener(java.awt.event.ActionListener listener)
          Removes an ActionListener from this item.
 void setBackgroundRenderer(BackgroundRenderer backgroundRenderer)
          Registers a new background renderer for this item.
 void setHorizontalAlignment(int alignment)
          Sets the horizontal text alignment for each of the three states.
 void setHorizontalTextPosition(int textPosition)
          Sets the horizontal text position for each of the three states.
 void setIcon(javax.swing.ImageIcon imageIcon)
          Sets the icon to display for this item.
 void setItemColor(java.awt.Color c)
          Sets the color of the item text across all three states.
 void setItemFont(java.awt.Font font)
          Sets the Font used to display the text of this item.
 void setItemSelectedState(State itemSelectedState)
          Sets the State used to represent the item when it is selected.
 void setMouseNotOverState(State mouseNotOverState)
          Sets the State used to represent the item when the mouse is not over it, and it is not selected.
 void setMouseOverState(State mouseOverState)
          Sets the State used to represent the item when the mouse is over it, and it is not selected.
 void setSelected(boolean selected)
          Sets whether or not the NavBarItem is selected.
 void setText(java.lang.String title)
          Sets the text of this item.
 void setVerticalAlignment(int alignment)
          Sets the default vertical text alignment for each of the three states.
 void setVerticalTextPosition(int textPosition)
          Sets the vertical text position for each of the three states.
 
Methods inherited from class javax.swing.JLabel
getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setIcon, setIconTextGap, setLabelFor, 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, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, 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, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NavBarItem

public NavBarItem(java.lang.String title)
Creates a new NavBarItem with the specified title. Default values will be applied to each of the three states.

Parameters:
title - The title of this item.
Method Detail

addActionListener

public void addActionListener(java.awt.event.ActionListener listener)
Adds an ActionListener to this item. Use this mechanism to listen for item selection events.

Parameters:
listener - The ActionListener to be added

getBackgroundRenderer

public BackgroundRenderer getBackgroundRenderer()
Returns the renderer currently being used for this item. If no renderer has been assigned, this method will return null.

Returns:
The BackgroundRenderer being used for this item, or null

getItemSelectedState

public State getItemSelectedState()
Returns the State representing the item's appearance when selected.

Returns:
The item-selected State
See Also:
State

getMouseNotOverState

public State getMouseNotOverState()
Returns the State representing the item's appearance when tje mouse is not over it, and it is not selected.

Returns:
The mouse-not-over State for this item
See Also:
State

getMouseOverState

public State getMouseOverState()
Returns the State representing the item's appearance when the mouse is over it, and it is not selected.

Returns:
The mouse-over State for this item
See Also:
State

isSelected

public boolean isSelected()
Returns TRUE if this NavBarItem is currently selected. Note: a selected NavBarItem can be in a not-selected NavBarCategory.

Returns:
boolean

removeActionListener

public void removeActionListener(java.awt.event.ActionListener listener)
Removes an ActionListener from this item.

Parameters:
listener - The ActionListener to be removed

setBackgroundRenderer

public void setBackgroundRenderer(BackgroundRenderer backgroundRenderer)
Registers a new background renderer for this item.

Parameters:
backgroundRenderer - The BackgroundRenderer to use as the renderer for this category.

setHorizontalAlignment

public void setHorizontalAlignment(int alignment)

Sets the horizontal text alignment for each of the three states.

NOTE: These changes will be overriden if the changes are made before the item is added to a category.

Parameters:
alignment - One of the following constants defined in SwingConstants: LEFT, CENTER (the default), RIGHT, LEADING or TRAILING.
See Also:
JLabel.setHorizontalAlignment(int), NavBarCategory.setHorizontalAlignment(int), State.setHorizontalAlignment(int)

setHorizontalTextPosition

public void setHorizontalTextPosition(int textPosition)

Sets the horizontal text position for each of the three states.

NOTE: These changes will be overriden if the changes are made before the item is added to a category.

Parameters:
textPosition - One of the following constants defined in SwingConstants: LEFT, CENTER (default), RIGHT, LEADING, or TRAILING.
See Also:
JLabel.setHorizontalTextPosition(int), NavBarCategory.setHorizontalTextPosition(int), State.setHorizontalTextPosition(int)

setIcon

public void setIcon(javax.swing.ImageIcon imageIcon)
Sets the icon to display for this item.

Parameters:
imageIcon - The icon to display for this item.

setItemColor

public void setItemColor(java.awt.Color c)
Sets the color of the item text across all three states.

Parameters:
c - The new Color to use for the text of this item

setItemFont

public void setItemFont(java.awt.Font font)
Sets the Font used to display the text of this item.

Parameters:
font - The new Font for this item

setItemSelectedState

public void setItemSelectedState(State itemSelectedState)
Sets the State used to represent the item when it is selected.

Parameters:
itemSelectedState - The new item-selected State
See Also:
State

setMouseNotOverState

public void setMouseNotOverState(State mouseNotOverState)
Sets the State used to represent the item when the mouse is not over it, and it is not selected.

Parameters:
mouseNotOverState - The new mouse-not-over State
See Also:
State

setMouseOverState

public void setMouseOverState(State mouseOverState)
Sets the State used to represent the item when the mouse is over it, and it is not selected.

Parameters:
mouseOverState - The new mouse-over State
See Also:
State

setSelected

public void setSelected(boolean selected)
Sets whether or not the NavBarItem is selected. This will change the appearance of the NavBarItem according to the specified States.

Parameters:
selected - TRUE if the NavBarItem should appear selected.

setText

public void setText(java.lang.String title)
Sets the text of this item.

Parameters:
title - The updated text for this item

setVerticalAlignment

public void setVerticalAlignment(int alignment)

Sets the default vertical text alignment for each of the three states.

NOTE: These changes will be overriden if the changes are made before the item is added to a category.

Parameters:
alignment - One of the following constants defined in SwingConstants: TOP, CENTER (the default), or BOTTOM.
See Also:
JLabel.setVerticalAlignment(int), setVerticalAlignment(int), State.setVerticalAlignment(int)

setVerticalTextPosition

public void setVerticalTextPosition(int textPosition)

Sets the vertical text position for each of the three states.

NOTE: These changes will be overriden if the changes are made before the item is added to a category.

Parameters:
textPosition - One of the following constants defined in SwingConstants: TOP, CENTER, or BOTTOM (the default).
See Also:
JLabel.setVerticalTextPosition(int), NavBarCategory.setVerticalTextPosition(int), State.setVerticalTextPosition(int)


Copyright © 2004 SyGem Software. All Rights Reserved.