JIDE 3.5.15

com.jidesoft.pane
Class FloorTabbedPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JTabbedPane
                  extended by com.jidesoft.pane.FloorTabbedPane
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants

public class FloorTabbedPane
extends JTabbedPane

FloorTabbedPane is a different version of JTabbedPane. As we all know, JTabbedPane provides a way to organize multiple panes and allows user to see one pane at a time. FloorTabbedPane serves the same purpose. However it organizes the panes in a vertical way like as you see in Outlook Bar as in Microsoft Outlook 2000. Since it looks like a multiple-floor building, thus gets the name of FloorTabbedPane.

The interface and usage of FloorTabbedPane are the same as JTabbedPane. We even keep the name of methods to be the same so that you easily convert from JTabbedPane to FloorTabbedPane.

When switching the tab, you can see animation. You do have control over the speed of the animation. setInitDelay(int) is how many millisecond delay when you click on a new tab. setSteps(int) is how many steps during the animation - the large number, the more smooth. setStepDelay(int) is the delay between each step.

You can also add PropertyChangeListener to listen for PERCENTAGE_PROPERTY change. It will fired during hen animation. The value will 100 when animates starts and 0 when animation ends. So you can use this value to determine if the FloorTabbedPane is in animation.

See Also:
Serialized Form

Nested Class Summary
protected  class FloorTabbedPane.AccessibleJTabbedPane
          This class implements accessibility support for the JTabbedPane class.
 class FloorTabbedPane.FloorButton
           
 
Nested classes/interfaces inherited from class javax.swing.JTabbedPane
JTabbedPane.ModelListener
 
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
protected  Vector<AbstractButton> _buttons
          Buttons.
protected  int _nextIndex
           
protected  int _percentage
           
protected  int _prevIndex
           
static String PERCENTAGE_PROPERTY
           
static String PROPERTY_ORIENTATION
           
 
Fields inherited from class javax.swing.JTabbedPane
changeEvent, changeListener, model, SCROLL_TAB_LAYOUT, tabPlacement, WRAP_TAB_LAYOUT
 
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 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
FloorTabbedPane()
          Creates FloorTabbedPane with default animation settings for tab switching animation.
FloorTabbedPane(int initDelay, int stepDelay, int steps)
          Creates FloorTabbedPane with specified animation settings for tab switching animation.
 
Method Summary
protected  AbstractButton createButton(Action action)
          Creates the button used by FloorTabbedPane.
protected  LayoutManager createLayout()
           
protected  Action createSwitchPageAction(String title, Icon icon, int index)
           
protected  void customizeButton(AbstractButton button)
          Customizes the button used by FloorTabbedPane.
 AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this JTabbedPane.
 Function getAnimationFunction()
          Gets the animation function that is used to animate the showing effect of the content.
 Color getBackgroundAt(int index)
           
 Vector<AbstractButton> getButtons()
          Gets the buttons used by this FloorTabbedPane in a Vector.
 Icon getDisabledIconAt(int index)
           
 int getDisplayedMnemonicIndexAt(int tabIndex)
           
 Color getForegroundAt(int index)
           
 Icon getIconAt(int index)
           
 int getInitDelay()
          Gets the initial delay when the button is pressed before it starts to switch.
 int getMnemonicAt(int tabIndex)
           
 int getNextIndex()
          Gets the next selected tab index.
 int getOrientation()
          Gets the orientation.
 int getPercentage()
          Gets the percentage that the animation has accomplished.
 int getPrevIndex()
          Gets the previous selected tab index.
 int getStepDelay()
          Gets the delay in each step during animation.
 int getSteps()
          Gets how many steps in the animation.
 String getTitleAt(int index)
           
 String getToolTipTextAt(int index)
           
 void insertTab(String title, Icon icon, Component component, String tip, int index)
          Overrides to insert a button for this new tab.
 boolean isEnabledAt(int index)
           
 void removeTabAt(int index)
          Overrides to remove the button for the tab index.
 void setAnimationFunction(Function animationFunction)
          Sets the animation function.
 void setBackgroundAt(int index, Color background)
           
 void setDisabledIconAt(int index, Icon disabledIcon)
           
 void setDisplayedMnemonicIndexAt(int tabIndex, int mnemonicIndex)
           
 void setEnabledAt(int index, boolean enabled)
           
 void setForegroundAt(int index, Color foreground)
           
 void setIconAt(int index, Icon icon)
           
 void setInitDelay(int initDelay)
          Sets the initial delay when the button is pressed before it starts to switch, in ms.
 void setMnemonicAt(int tabIndex, int mnemonic)
           
 void setOrientation(int orientation)
          Sets the orientation.
 void setSelectedIndex(int index)
          Sets the selected index.
 void setStepDelay(int stepDelay)
          Sets the delay in each step during animation, in ms.
 void setSteps(int steps)
          Sets how many steps in the animation, default is 10 steps.
 void setTitleAt(int index, String title)
           
 void setToolTipTextAt(int index, String toolTipText)
           
protected  void updateButtonSelectionState(int index)
          Selects the button that represents the selected tab.
 void updateUI()
          Resets the UI property to a value from the current look and feel.
 
Methods inherited from class javax.swing.JTabbedPane
add, add, add, add, add, addChangeListener, addTab, addTab, addTab, createChangeListener, fireStateChanged, getBoundsAt, getChangeListeners, getComponentAt, getModel, getSelectedComponent, getSelectedIndex, getTabComponentAt, getTabCount, getTabLayoutPolicy, getTabPlacement, getTabRunCount, getToolTipText, getUI, getUIClassID, indexAtLocation, indexOfComponent, indexOfTab, indexOfTab, indexOfTabComponent, paramString, remove, remove, removeAll, removeChangeListener, setComponentAt, setModel, setSelectedComponent, setTabComponentAt, setTabLayoutPolicy, setTabPlacement, 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, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, 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
addContainerListener, addImpl, 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, 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

_buttons

protected Vector<AbstractButton> _buttons
Buttons.


_percentage

protected int _percentage

_nextIndex

protected int _nextIndex

_prevIndex

protected int _prevIndex

PERCENTAGE_PROPERTY

public static String PERCENTAGE_PROPERTY

PROPERTY_ORIENTATION

public static String PROPERTY_ORIENTATION
Constructor Detail

FloorTabbedPane

public FloorTabbedPane()
Creates FloorTabbedPane with default animation settings for tab switching animation.


FloorTabbedPane

public FloorTabbedPane(int initDelay,
                       int stepDelay,
                       int steps)
Creates FloorTabbedPane with specified animation settings for tab switching animation.

Parameters:
initDelay - the initial delay before animation starts. The value is in milliseconds.
stepDelay - the delay between each step. The value is in milliseconds.
steps - the number of steps in the animation. The larger number, the more smooth the animation.
Method Detail

updateUI

public void updateUI()
Resets the UI property to a value from the current look and feel. Don't call super.updateUI() since it shouldn't use default JTabbedPane UI at all.

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

createLayout

protected LayoutManager createLayout()

createSwitchPageAction

protected Action createSwitchPageAction(String title,
                                        Icon icon,
                                        int index)

getPercentage

public int getPercentage()
Gets the percentage that the animation has accomplished.

Returns:
the percentag.
Since:
3.4.5

getButtons

public Vector<AbstractButton> getButtons()
Gets the buttons used by this FloorTabbedPane in a Vector.

Returns:
vector of buttons.

getPrevIndex

public int getPrevIndex()
Gets the previous selected tab index.

Returns:
the previous selected tab index.
Since:
3.4.5

getNextIndex

public int getNextIndex()
Gets the next selected tab index.

Returns:
the next selected tab index.
Since:
3.4.5

removeTabAt

public void removeTabAt(int index)
Overrides to remove the button for the tab index. If the tab being removed is selected, it will try to select next tab unless the removed tab is the last one. If so, it will select previous tab.

Overrides:
removeTabAt in class JTabbedPane
Parameters:
index - the tab index

insertTab

public void insertTab(String title,
                      Icon icon,
                      Component component,
                      String tip,
                      int index)
Overrides to insert a button for this new tab.

Overrides:
insertTab in class JTabbedPane
Parameters:
title - the title to be displayed in this tab
icon - the icon to be displayed in this tab
component - The component to be displayed when this tab is clicked.
tip - the tooltip to be displayed for this tab
index - the position to insert this new tab

createButton

protected AbstractButton createButton(Action action)
Creates the button used by FloorTabbedPane. Subclass can override it to create its own button. But those buttons must implement UIResource. Otherwise, a runtime IllegalArgumentException will be thrown.

Parameters:
action - the action for the button.
Returns:
button used by FloorTabbedPane.

setSelectedIndex

public void setSelectedIndex(int index)
Sets the selected index.

Overrides:
setSelectedIndex in class JTabbedPane
Parameters:
index - the new selected index

updateButtonSelectionState

protected void updateButtonSelectionState(int index)
Selects the button that represents the selected tab.

Parameters:
index - the selected tab index.

getMnemonicAt

public int getMnemonicAt(int tabIndex)
Overrides:
getMnemonicAt in class JTabbedPane

setMnemonicAt

public void setMnemonicAt(int tabIndex,
                          int mnemonic)
Overrides:
setMnemonicAt in class JTabbedPane

getDisplayedMnemonicIndexAt

public int getDisplayedMnemonicIndexAt(int tabIndex)
Overrides:
getDisplayedMnemonicIndexAt in class JTabbedPane

setDisplayedMnemonicIndexAt

public void setDisplayedMnemonicIndexAt(int tabIndex,
                                        int mnemonicIndex)
Overrides:
setDisplayedMnemonicIndexAt in class JTabbedPane

setTitleAt

public void setTitleAt(int index,
                       String title)
Overrides:
setTitleAt in class JTabbedPane

getTitleAt

public String getTitleAt(int index)
Overrides:
getTitleAt in class JTabbedPane

getIconAt

public Icon getIconAt(int index)
Overrides:
getIconAt in class JTabbedPane

setIconAt

public void setIconAt(int index,
                      Icon icon)
Overrides:
setIconAt in class JTabbedPane

getDisabledIconAt

public Icon getDisabledIconAt(int index)
Overrides:
getDisabledIconAt in class JTabbedPane

setDisabledIconAt

public void setDisabledIconAt(int index,
                              Icon disabledIcon)
Overrides:
setDisabledIconAt in class JTabbedPane

getToolTipTextAt

public String getToolTipTextAt(int index)
Overrides:
getToolTipTextAt in class JTabbedPane

setToolTipTextAt

public void setToolTipTextAt(int index,
                             String toolTipText)
Overrides:
setToolTipTextAt in class JTabbedPane

isEnabledAt

public boolean isEnabledAt(int index)
Overrides:
isEnabledAt in class JTabbedPane

setEnabledAt

public void setEnabledAt(int index,
                         boolean enabled)
Overrides:
setEnabledAt in class JTabbedPane

setForegroundAt

public void setForegroundAt(int index,
                            Color foreground)
Overrides:
setForegroundAt in class JTabbedPane

getForegroundAt

public Color getForegroundAt(int index)
Overrides:
getForegroundAt in class JTabbedPane

setBackgroundAt

public void setBackgroundAt(int index,
                            Color background)
Overrides:
setBackgroundAt in class JTabbedPane

getBackgroundAt

public Color getBackgroundAt(int index)
Overrides:
getBackgroundAt in class JTabbedPane

getInitDelay

public int getInitDelay()
Gets the initial delay when the button is pressed before it starts to switch.

Returns:
the initial delay

setInitDelay

public void setInitDelay(int initDelay)
Sets the initial delay when the button is pressed before it starts to switch, in ms. Default is 50ms.

Parameters:
initDelay - the initial delay

getStepDelay

public int getStepDelay()
Gets the delay in each step during animation.

Returns:
the delay in each step

setStepDelay

public void setStepDelay(int stepDelay)
Sets the delay in each step during animation, in ms. Default is 5ms.

Parameters:
stepDelay - the delay in each step

getSteps

public int getSteps()
Gets how many steps in the animation.

Returns:
number of the steps

setSteps

public void setSteps(int steps)
Sets how many steps in the animation, default is 10 steps.

Parameters:
steps - number of the steps. It should be a non-negative integer. Otherwise, IllegalArgumentException will be thrown.
Throws:
IllegalArgumentException - if the steps value is less than 0.

getAnimationFunction

public Function getAnimationFunction()
Gets the animation function that is used to animate the showing effect of the content.

Returns:
the animation function.

setAnimationFunction

public void setAnimationFunction(Function animationFunction)
Sets the animation function.

Parameters:
animationFunction - the animation function.

customizeButton

protected void customizeButton(AbstractButton button)
Customizes the button used by FloorTabbedPane. Subclass can override it to customize the button.

Parameters:
button - the button to be customized

getOrientation

public int getOrientation()
Gets the orientation. By default it is SwingContent.VERTICAL which means the button sliding up and down to show the tab content. You can also set the orientation to SwingContent.HORIZONTAL so that the button sliding left and right.

Returns:
the orientation.

setOrientation

public void setOrientation(int orientation)
Sets the orientation. By default it is SwingContent.VERTICAL which means the button sliding up and down to show the tab content. You can also set the orientation to SwingContent.HORIZONTAL so that the button sliding left and right.

Parameters:
orientation - the orientation. The valid value is SwingContent.HORIZONTAL and SwingContent.VERTICAL.

getAccessibleContext

public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this JTabbedPane. For tabbed panes, the AccessibleContext takes the form of an AccessibleJTabbedPane. A new AccessibleJTabbedPane instance is created if necessary.

Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JTabbedPane
Returns:
an AccessibleJTabbedPane that serves as the AccessibleContext of this JTabbedPane

JIDE 3.5.15