|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.sygem.swing.joutlooknavbar.NavBarCategory
This class represents a single category, containing one or more items.
Within each category, you can customize the rendering of the background, the font used by the header, and the foreground and background colours as well.
ActionListeners can be registered against the header button - use these to be informed of when a category is selected. NOTE: events will be generated every time the header is clicked on, even if the category is already open. To determine if a category is open, use the isOpen() method.
If the size of the items in the category is larger than the space available, a scroll-bar will be displayed to let users get at all items.
Title: JOutlookNavBar
Description: A Swing component simulating Outlook's Nav Bar
Copyright: Copyright (c) 2004
Company: SyGem Software
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 java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
NavBarCategory(java.lang.String title)
Standard constructor - The title string will be displayed on the header button. |
Method Summary | |
void |
addActionListener(java.awt.event.ActionListener listener)
Registers an ActionListener against the category. |
void |
addItem(NavBarItem item)
Adds a NavBarItem to this category. |
BackgroundRenderer |
getBackgroundRenderer()
Returns the renderer currently being used for this category. |
NavBarItem |
getItem(java.lang.String itemText)
Retrieves a NavBarItem from the category, based on its Text value. |
State |
getItemSelectedState()
Returns the State representing the default values an item will inherit when selected. |
State |
getMouseNotOverState()
Returns the State representing the default values an item will inherit when the mouse is not over the item, and it is not selected. |
State |
getMouseOverState()
Returns the State representing the default values an item will inherit when the mouse is over the item, and it is not selected. |
NavBarItem |
getSelectedItem()
Returns the currently selected NavBarItem from this NavBarCategory. |
boolean |
isOpen()
Returns true if this category is currently open. |
void |
openCategory(boolean generateEvent)
Allows you to programmatically open a NavBarCategory. |
void |
removeActionListener(java.awt.event.ActionListener listener)
Removes an ActionListener from this category. |
boolean |
removeItem(NavBarItem item)
Removes an item from this category |
void |
selectNavBarItem(NavBarItem item,
boolean generateEvent)
Allows you to programmatically select a NavBarItem. |
void |
setBackgroundColor(java.awt.Color c)
Sets the background color of the category header button. |
void |
setBackgroundRenderer(BackgroundRenderer backgroundRenderer)
Registers a new background renderer for this category. |
void |
setFont(java.awt.Font font)
Sets the font used on the category header button. |
void |
setHorizontalAlignment(int alignment)
Sets the default horizontal text alignment for each of the three states. |
void |
setHorizontalTextPosition(int textPosition)
Sets the default horizontal text position for each of the three states. |
void |
setInsets(java.awt.Insets insets)
Sets a boundary around each item. |
void |
setItemColors(java.awt.Color c)
Sets the default colors for each of the three states. |
void |
setItemFonts(java.awt.Font font)
Sets the default font for each of the three states. |
void |
setItemSelectedState(State s)
Sets the default set of attributes an item will be given when the item is selected. |
void |
setMouseNotOverState(State s)
Sets the default set of attributes an item will be given when the mouse is not over it, and it is not selected. |
void |
setMouseOverState(State s)
Sets the default set of attributes an item will be given when the mouse is moved over it, and it is not selected. |
void |
setTextColor(java.awt.Color c)
Sets the foreground (text) color of the category header button. |
void |
setVerticalAlignment(int alignment)
Sets the default vertical text alignment for each of the three states. |
void |
setVerticalTextPosition(int textPosition)
Sets the default vertical text position for each of the three states. |
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, getAccessibleContext, 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, getUIClassID, 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, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
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, 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, 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 |
public NavBarCategory(java.lang.String title)
title
- The title of this CategoryMethod Detail |
public void addActionListener(java.awt.event.ActionListener listener)
Registers an ActionListener against the category.
ActionEvents are generated whenever the category header is clicked on - even if the category is currently on show.
The getSource() method of the ActionEvent will return the NavBarCategory.
listener
- The ActionListener to addpublic void addItem(NavBarItem item)
item
- The NavBarItem to addpublic BackgroundRenderer getBackgroundRenderer()
public NavBarItem getItem(java.lang.String itemText)
itemText
- The Text of the item to be retrieved
public State getItemSelectedState()
State
public State getMouseNotOverState()
State
public State getMouseOverState()
State
public NavBarItem getSelectedItem()
null
.
null
public boolean isOpen()
public void openCategory(boolean generateEvent)
generateEvent
- A value of TRUE will cause events to be generatedpublic void removeActionListener(java.awt.event.ActionListener listener)
listener
- The ActionListener to removepublic boolean removeItem(NavBarItem item)
item
- The NavBarItem to remove
public void selectNavBarItem(NavBarItem item, boolean generateEvent)
item
- The NavBarItem to be selected.generateEvent
- Set this to TRUE if you want the NavBarItem's ActionListeners to be informed of the selectionpublic void setBackgroundColor(java.awt.Color c)
c
- The background color of the header buttonpublic void setBackgroundRenderer(BackgroundRenderer backgroundRenderer)
backgroundRenderer
- The BackgroundRenderer to use as the renderer for this category.public void setFont(java.awt.Font font)
font
- The Font that will be used on the header buttonpublic void setHorizontalAlignment(int alignment)
Sets the default horizontal text alignment for each of the three states.
NOTE: These changes will override changes made to the states of any item before they are added to a category.
alignment
- One of the following constants defined in SwingConstants: LEFT, CENTER (the default), RIGHT, LEADING or TRAILING.JLabel.setHorizontalAlignment(int)
,
NavBarItem.setHorizontalAlignment(int)
,
State.setHorizontalAlignment(int)
public void setHorizontalTextPosition(int textPosition)
Sets the default horizontal text position for each of the three states.
NOTE: These changes will override changes made to the states of any item before they are added to a category.
textPosition
- One of the following constants defined in SwingConstants: LEFT, CENTER (default), RIGHT, LEADING, or TRAILING.JLabel.setHorizontalTextPosition(int)
,
NavBarItem.setHorizontalTextPosition(int)
,
State.setHorizontalTextPosition(int)
public void setInsets(java.awt.Insets insets)
insets
- The insets representing the item boundarypublic void setItemColors(java.awt.Color c)
Sets the default colors for each of the three states.
NOTE: These changes will override changes made to the states of any item before they are added to a category.
c
- The new default Color for new NavBarItemspublic void setItemFonts(java.awt.Font font)
Sets the default font for each of the three states.
NOTE: These changes will override changes made to the states of any item before they are added to a category.
font
- The new default Font for new NavBarItemspublic void setItemSelectedState(State s)
s
- The new item-selected StateState
public void setMouseNotOverState(State s)
s
- The new mouse-not-over StateState
public void setMouseOverState(State s)
s
- The new mouse-over StateState
public void setTextColor(java.awt.Color c)
c
- The text color on the header buttonpublic void setVerticalAlignment(int alignment)
Sets the default vertical text alignment for each of the three states.
NOTE: These changes will override changes made to the states of any item before they are added to a category.
alignment
- One of the following constants defined in SwingConstants: TOP, CENTER (the default), or BOTTOM.JLabel.setVerticalAlignment(int)
,
NavBarItem.setVerticalAlignment(int)
,
State.setVerticalAlignment(int)
public void setVerticalTextPosition(int textPosition)
Sets the default vertical text position for each of the three states.
NOTE: These changes will override changes made to the states of any item before they are added to a category.
textPosition
- One of the following constants defined in SwingConstants: TOP, CENTER, or BOTTOM (the default).JLabel.setVerticalTextPosition(int)
,
NavBarItem.setVerticalTextPosition(int)
,
State.setVerticalTextPosition(int)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |