net.infonode.tabbedpanel
Class TabbedPanel

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 net.infonode.tabbedpanel.TabbedPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class TabbedPanel
extends javax.swing.JPanel

A TabbedPanel is a component that handles a group of components in a notebook like manor. Each component is represented by a Tab. A tab is a component itself that defines how the tab will be rendered. The tab also holds a reference to the content component associated with the tab. The tabbed panel is divided into two areas, the tab area where the tabs are displayed and the content area where the tab's content component is displayed.

The demo program for InfoNode Tabbed Panel on www.infonode.net demonstrates and explains most of the tabbed panel's features.

The tabbed panel is configured using a TabbedPanelProperties object. A tabbed panel will always have a properties object with default values based on the current Look and Feel

Tabs can be added, inserted, removed, selected, highlighted, dragged and moved.

The tabbed panel support tab placement in a horizontal line above or under the content area or a vertical row to the left or to the right of the content area. The tab line can be laid out as either scrolling or compression. If the tabs are too many to fit in the tab area and scrolling is enabled, then the mouse wheel is activated and scrollbuttons are shown so that the tabs can be scrolled. Compression means that the tabs will be downsized to fit into the visible tab area.

It is possible to display a button in the tab area next to the tabs that shows a drop down list (called tab drop down list) with all the tabs where it is possible to select a tab. This is for example useful when the tabbed panel contains a large amount of tabs or if some tabs are scrolled out. The drop down list can show a text and an icon for a tab. The text is retrieved by calling toString() on the tab and the icon is only retrieved if the tab implements the IconProvider interface.

It is possible to set an array of components (called tab area components) to be shown next to the tabs in the tab area, the same place where the drop down list and the scrollbuttons are shown. This for example useful for adding buttons to the tabbed panel.

It is possible to add a TabListener and receive events when a tab is added, removed, selected, deselected, highlighted, dehighlighted, moved, dragged, dropped or drag is aborted. The listener will receive events for all the tabs in the tabbed panel. A tabbed panel will trigger selected, deselected, highlighted and dehighlighted even if for example the selected tab is null (no selected tab), i.e. null will be treated as if it was a tab.

A tabbed panel supports several mouse hover alternatives. It is possible to specify HoverListeners for the entire tabbed panel, the tab area, the tab area components area and the content area. The listeners are set in the TabbedPanelProperties, TabAreaProperties, TabAreaComponentsProperties and the TabbedPanelContentPanelProperties. A hover listener is called when the mouse enter or exits the area. The hover listener is called with a HoverEvent and the source for the event is always the hovered tabbed panel.

A tabbed panel calls the hover listeners in the following order:

  1. The hover listener for the tabbed panel itself.
  2. The hover listener for the tab area or the content area depending on where the mouse pointer is located.
  3. The hover listener for the tab area components area if the mouse pointer is over that area.
When the tabbed panel is no longer hovered, the hover listenrs are called in the reverse order.

It is possible to specify different hover policies (TabbedPanelHoverPolicy) in the TabbedPanelProperties that affects all hover areas of the tabbed panel.

Version:
$Revision: 1.167 $
Author:
$Author: jesper $
See Also:
Tab, TitledTab, TabbedPanelProperties, TabListener, TabbedPanelHoverPolicy, HoverListener, Serialized Form

Nested Class Summary
private  class TabbedPanel.HoverablePanel
           
private  class TabbedPanel.ShadowPanel
           
 
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
private  TabAreaVisiblePolicy areaVisiblePolicy
           
private  TabbedPanel.ShadowPanel componentsPanel
           
private  java.awt.GridBagConstraints constraints
           
private  javax.swing.JComponent contentPanel
           
private  DraggableComponentBox draggableComponentBox
           
private  DraggableComponentBoxListener draggableComponentBoxListener
           
private  TabDropDownList dropDownList
           
private  Tab highlightedTab
           
private  java.util.ArrayList listeners
           
private  TabLayoutPolicy listTabLayoutPolicy
           
private  TabDropDownListVisiblePolicy listVisiblePolicy
           
private  boolean mouseEntered
           
private  TabbedPanelProperties properties
           
private  PropertyMapTreeListener propertyChangedListener
           
private  boolean removingSelected
           
private  ScrollButtonBox scrollButtonBox
           
private  boolean settingHighlighted
           
private  ComponentPaintChecker shadowRepaintChecker
           
private  int shadowSize
           
private  javax.swing.JComponent[] tabAreaComponents
           
private  HoverableShapedPanel tabAreaComponentsPanel
           
private  HoverableShapedPanel tabAreaContainer
           
private  java.awt.GridBagLayout tabAreaLayoutManager
           
private  Direction tabAreaOrientation
           
 
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
TabbedPanel()
          Constructs a TabbedPanel with a TabbedPanelContentPanel as content area component and with default TabbedPanelProperties
TabbedPanel(javax.swing.JComponent contentAreaComponent)
           Constructs a TabbedPanel with a custom component as content area component or without any content area component and with default TabbedPanelProperties.
TabbedPanel(javax.swing.JComponent contentAreaComponent, boolean useProperties)
           Constructs a TabbedPanel with a custom component as content area component or without any content area component and with default TabbedPanelProperties.
 
Method Summary
 void addTab(Tab tab)
           Add a tab.
 void addTabListener(TabListener listener)
          Adds a TablListener that will receive events for all the tabs in this TabbedPanel
private  int calcScrollHeight()
           
private  int calcScrollWidth()
           
private  void checkIfOnlyOneTab(boolean inc)
           
 boolean contentAreaContainsPoint(java.awt.Point p)
          Check if the content area contains the given point
private  void doInsertTab(Tab tab, java.awt.Point p, int index)
           
(package private)  void doProcessMouseEvent(java.awt.event.MouseEvent event)
           
(package private)  void doProcessMouseMotionEvent(java.awt.event.MouseEvent event)
           
private  Tab findTab(DraggableComponent draggableComponent)
           
private  void fireAddedEvent(Tab tab)
           
private  void fireDraggedEvent(Tab tab, java.awt.event.MouseEvent mouseEvent)
           
private  void fireDroppedEvent(Tab tab, java.awt.event.MouseEvent mouseEvent)
           
private  void fireHighlightedEvent(Tab tab, Tab oldTab)
           
private  void fireNotDroppedEvent(Tab tab)
           
private  void fireRemovedEvent(Tab tab)
           
private  void fireSelectedEvent(Tab tab, Tab oldTab)
           
private  void fireTabMoved(Tab tab)
           
(package private)  DraggableComponentBox getDraggableComponentBox()
           
 Tab getHighlightedTab()
          Gets the highlighted tab
private  java.util.Map getMap(java.util.Map changes, PropertyMap map)
           
 TabbedPanelProperties getProperties()
          Gets the TabbedPanelProperties
 Tab getSelectedTab()
          Gets the selected tab, i.e. the tab who's content component is currently displayed in this tabbed panel's content area
 javax.swing.JComponent[] getTabAreaComponents()
          Gets the tab area components.
 Tab getTabAt(int index)
          Gets the tab at index
 int getTabCount()
          Gets the number of tabs
 int getTabIndex(Tab tab)
          Gets the index for tab
 boolean hasContentArea()
          Checks if this tabbed panel has a content area
private  void initialize(javax.swing.JComponent contentPanel)
           
 void insertTab(Tab tab, int index)
           Insert a tab at the specified tab index (position).
 void insertTab(Tab tab, java.awt.Point p)
           Insert a tab at the specified point.
 boolean isTabAreaComponentsVisible()
          Gets if any tab area components i.e. scroll buttons etc are visible at the moment
 boolean isTabAreaVisible()
          Checks if the tab area is currently visible
 void moveTab(Tab tab, java.awt.Point p)
          Move tab to point p.
protected  void processMouseEvent(java.awt.event.MouseEvent event)
           
 void removeTab(Tab tab)
          Removes a tab
 void removeTabListener(TabListener listener)
          Removes a TabListener
 void scrollTabToVisibleArea(Tab tab)
           Scrolls the given tab into the visible area of the tab area.
 void setHighlightedTab(Tab highlightedTab)
          Sets which tab that should be highlighted, i.e. signal highlighted state to the tab
 void setSelectedTab(Tab tab)
          Selects a tab, i.e. displays the tab's content component in this tabbed panel's content area
 void setTabAreaComponents(javax.swing.JComponent[] tabAreaComponents)
          Sets an array of components that will be shown in the tab area next to the tabs, i.e. to the right or below the tabs depending on the tab area orientation.
private  void setTabAreaComponentsButtonsVisible()
           
private  void setTabAreaLayoutConstraints(javax.swing.JComponent c, int gridx, int gridy, int fill, double weightx, double weighty, int anchor)
           
 boolean tabAreaContainsPoint(java.awt.Point p)
          Check if the tab area contains the given point
private  void updateAllDefaultValues()
           
private  void updateAllTabsProperties()
           
private  void updateIntelligentInsets(javax.swing.JComponent c, ComponentProperties props)
           
private  void updatePanelOpaque()
           
private  void updateProperties(java.util.Map changes)
           
private  void updatePropertiesForTabArea(java.util.Map changes)
           
private  void updatePropertiesForTabAreaComponentsArea(java.util.Map changes)
           
private  void updatePropertiesForTabAreaComponentsButtons(java.util.Map changes)
           
private  void updatePropertiesForTabAreaLayoutConstraints()
           
private  void updateScrollButtons()
           
private  void updateShadow()
           
private  void updateShapedPanelProperties(ShapedPanel panel, ShapedPanelProperties shapedPanelProperties)
           
private  void updateTabAreaComponentsPanel(Direction direction, int alignmentX, int alignmentY)
           
private  void updateTabAreaVisibility()
           
private  void updateTabDropDownList()
           
private  void updateTabProperties(Tab tab)
           
 
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, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, 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, 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

shadowSize

private int shadowSize

shadowRepaintChecker

private ComponentPaintChecker shadowRepaintChecker

dropDownList

private TabDropDownList dropDownList

contentPanel

private javax.swing.JComponent contentPanel

tabAreaComponents

private javax.swing.JComponent[] tabAreaComponents

tabAreaOrientation

private Direction tabAreaOrientation

listVisiblePolicy

private TabDropDownListVisiblePolicy listVisiblePolicy

listTabLayoutPolicy

private TabLayoutPolicy listTabLayoutPolicy

draggableComponentBox

private DraggableComponentBox draggableComponentBox

listeners

private java.util.ArrayList listeners

properties

private TabbedPanelProperties properties

highlightedTab

private Tab highlightedTab

settingHighlighted

private boolean settingHighlighted

mouseEntered

private boolean mouseEntered

removingSelected

private boolean removingSelected

areaVisiblePolicy

private TabAreaVisiblePolicy areaVisiblePolicy

componentsPanel

private TabbedPanel.ShadowPanel componentsPanel

scrollButtonBox

private ScrollButtonBox scrollButtonBox

constraints

private java.awt.GridBagConstraints constraints

tabAreaLayoutManager

private java.awt.GridBagLayout tabAreaLayoutManager

tabAreaContainer

private HoverableShapedPanel tabAreaContainer

tabAreaComponentsPanel

private HoverableShapedPanel tabAreaComponentsPanel

draggableComponentBoxListener

private DraggableComponentBoxListener draggableComponentBoxListener

propertyChangedListener

private PropertyMapTreeListener propertyChangedListener
Constructor Detail

TabbedPanel

public TabbedPanel()
Constructs a TabbedPanel with a TabbedPanelContentPanel as content area component and with default TabbedPanelProperties

See Also:
TabbedPanelProperties, TabbedPanelContentPanel

TabbedPanel

public TabbedPanel(javax.swing.JComponent contentAreaComponent)

Constructs a TabbedPanel with a custom component as content area component or without any content area component and with default TabbedPanelProperties. The properties for the content area will not be used.

If no content area component is used, then the tabbed panel will act as a bar and the tabs will be laid out in a line.

Note: A custom content area component is by itself responsible for showing a tab's content component when a tab is selected, for eaxmple by listening to events from the tabbed panel. The component will be laid out just as the default content area component so that shadows etc. can be used.

Parameters:
contentAreaComponent - component to be used as content area component or null for no content area component
See Also:
TabbedPanelProperties

TabbedPanel

public TabbedPanel(javax.swing.JComponent contentAreaComponent,
                   boolean useProperties)

Constructs a TabbedPanel with a custom component as content area component or without any content area component and with default TabbedPanelProperties. It's possible to choose if the properties for the content area should be used or not.

If no content area component is used, then the tabbed panel will act as a bar and the tabs will be laid out in a line.

Note: A custom content area component is by itself responsible for showing a tab's content component when a tab is selected, for eaxmple by listening to events from the tabbed panel. The component will be laid out just as the default content area component so that shadows etc. can be used.

Parameters:
contentAreaComponent - component to be used as content area component or null for no content area component
useProperties - true if the properties for the content area should be used, otherwise false
Since:
ITP 1.4.0
See Also:
TabbedPanelProperties
Method Detail

updatePropertiesForTabAreaComponentsButtons

private void updatePropertiesForTabAreaComponentsButtons(java.util.Map changes)

updateAllDefaultValues

private void updateAllDefaultValues()

updateProperties

private void updateProperties(java.util.Map changes)

updatePropertiesForTabArea

private void updatePropertiesForTabArea(java.util.Map changes)

updateIntelligentInsets

private void updateIntelligentInsets(javax.swing.JComponent c,
                                     ComponentProperties props)

updatePropertiesForTabAreaComponentsArea

private void updatePropertiesForTabAreaComponentsArea(java.util.Map changes)

updatePropertiesForTabAreaLayoutConstraints

private void updatePropertiesForTabAreaLayoutConstraints()

getMap

private java.util.Map getMap(java.util.Map changes,
                             PropertyMap map)

updateTabAreaVisibility

private void updateTabAreaVisibility()

tabAreaContainsPoint

public boolean tabAreaContainsPoint(java.awt.Point p)
Check if the tab area contains the given point

Parameters:
p - the point to check. Must be relative to this tabbed panel.
Returns:
true if tab area contains point, otherwise false
See Also:
contentAreaContainsPoint(java.awt.Point)

contentAreaContainsPoint

public boolean contentAreaContainsPoint(java.awt.Point p)
Check if the content area contains the given point

Parameters:
p - the point to check. Must be relative to this tabbed panel.
Returns:
true if content area contains point, otherwise false
See Also:
tabAreaContainsPoint(java.awt.Point)

isTabAreaVisible

public boolean isTabAreaVisible()
Checks if the tab area is currently visible

Returns:
true if visible, otherwise false
Since:
ITP 1.4.0

addTab

public void addTab(Tab tab)

Add a tab. The tab will be added after the last tab.

If the tab to be added is the only tab in this tabbed panel and the property "Auto Select Tab" is enabled then the tab will become selected in this tabbed panel after the tab has been added.

Parameters:
tab - tab to be added
See Also:
insertTab(Tab, int), TabbedPanelProperties

insertTab

public void insertTab(Tab tab,
                      int index)

Insert a tab at the specified tab index (position).

If the tab to be inserted is the only tab in this tabbed panel and the property "Auto Select Tab" is enabled then the tab will become selected in this tabbed panel after the tab has been inserted.

Parameters:
tab - tab to be inserted
index - the index to insert tab at
See Also:
addTab(net.infonode.tabbedpanel.Tab), TabbedPanelProperties

insertTab

public void insertTab(Tab tab,
                      java.awt.Point p)

Insert a tab at the specified point.

If the point is outside the tab area then the tab will be inserted after the last tab.

If the tab to be inserted is the only tab in this tabbed panel and the property "Auto Select Tab" is enabled then the tab will become selected in this tabbed panel after the tab has been inserted.

Parameters:
tab - tab to be inserted
p - the point to insert tab at. Must be relative to this tabbed panel.
See Also:
addTab(net.infonode.tabbedpanel.Tab), TabbedPanelProperties

removeTab

public void removeTab(Tab tab)
Removes a tab

Parameters:
tab - tab to be removed from this TabbedPanel

moveTab

public void moveTab(Tab tab,
                    java.awt.Point p)
Move tab to point p. If p is outside the tab area then the tab is not moved.

Parameters:
tab - tab to move. Tab must be a member (added/inserted) of this tabbed panel.
p - point to move tab to. Must be relative to this tabbed panel.

setSelectedTab

public void setSelectedTab(Tab tab)
Selects a tab, i.e. displays the tab's content component in this tabbed panel's content area

Parameters:
tab - tab to select. Tab must be a member (added/inserted) of this tabbed panel.

getSelectedTab

public Tab getSelectedTab()
Gets the selected tab, i.e. the tab who's content component is currently displayed in this tabbed panel's content area

Returns:
the selected tab or null if no tab is selected in this tabbed panel

setHighlightedTab

public void setHighlightedTab(Tab highlightedTab)
Sets which tab that should be highlighted, i.e. signal highlighted state to the tab

Parameters:
highlightedTab - tab that should be highlighted or null if no tab should be highlighted. The tab must be a member (added/inserted) of this tabbed panel.

getHighlightedTab

public Tab getHighlightedTab()
Gets the highlighted tab

Returns:
the highlighted tab or null if no tab is highlighted in this tabbed panel

getTabCount

public int getTabCount()
Gets the number of tabs

Returns:
number of tabs

getTabAt

public Tab getTabAt(int index)
Gets the tab at index

Parameters:
index - index of tab
Returns:
tab at index
Throws:
java.lang.ArrayIndexOutOfBoundsException - if there is no tab at index

getTabIndex

public int getTabIndex(Tab tab)
Gets the index for tab

Parameters:
tab - tab
Returns:
index or -1 if tab is not a member of this TabbedPanel

scrollTabToVisibleArea

public void scrollTabToVisibleArea(Tab tab)

Scrolls the given tab into the visible area of the tab area.

Note: This only has effect if the active tab layout policy is scrolling.

Parameters:
tab - tab to scroll into visible tab area
Since:
ITP 1.4.0

setTabAreaComponents

public void setTabAreaComponents(javax.swing.JComponent[] tabAreaComponents)
Sets an array of components that will be shown in the tab area next to the tabs, i.e. to the right or below the tabs depending on the tab area orientation. The components will be laid out in a line and the direction will change depending on the tab area orientation. Tab drop down list and scroll buttons are also tab area components but those are handled automatically by the tabbed panel and are not affected by calling this method.

Parameters:
tabAreaComponents - array of components, null for no components
Since:
ITP 1.1.0

isTabAreaComponentsVisible

public boolean isTabAreaComponentsVisible()
Gets if any tab area components i.e. scroll buttons etc are visible at the moment

Returns:
true if visible, otherwise false
Since:
ITP 1.2.0

getTabAreaComponents

public javax.swing.JComponent[] getTabAreaComponents()
Gets the tab area components. Tab drop down list and scroll buttons are also tab area components but those are handled automatically by the tabbed panel and no references to them will be returned. This method only returns the components that have been set with the setTabAreaComponents method.

Returns:
an array of tab area components or null if none
Since:
ITP 1.1.0
See Also:
setTabAreaComponents(javax.swing.JComponent[])

addTabListener

public void addTabListener(TabListener listener)
Adds a TablListener that will receive events for all the tabs in this TabbedPanel

Parameters:
listener - the TabListener to add

removeTabListener

public void removeTabListener(TabListener listener)
Removes a TabListener

Parameters:
listener - the TabListener to remove

getProperties

public TabbedPanelProperties getProperties()
Gets the TabbedPanelProperties

Returns:
the TabbedPanelProperties for this tabbed panel

hasContentArea

public boolean hasContentArea()
Checks if this tabbed panel has a content area

Returns:
true if content area exist, otherwise false
Since:
ITP 1.3.0

getDraggableComponentBox

DraggableComponentBox getDraggableComponentBox()

initialize

private void initialize(javax.swing.JComponent contentPanel)

updateTabDropDownList

private void updateTabDropDownList()

updateAllTabsProperties

private void updateAllTabsProperties()

updateTabProperties

private void updateTabProperties(Tab tab)

updateTabAreaComponentsPanel

private void updateTabAreaComponentsPanel(Direction direction,
                                          int alignmentX,
                                          int alignmentY)

updateShapedPanelProperties

private void updateShapedPanelProperties(ShapedPanel panel,
                                         ShapedPanelProperties shapedPanelProperties)

setTabAreaLayoutConstraints

private void setTabAreaLayoutConstraints(javax.swing.JComponent c,
                                         int gridx,
                                         int gridy,
                                         int fill,
                                         double weightx,
                                         double weighty,
                                         int anchor)

doInsertTab

private void doInsertTab(Tab tab,
                         java.awt.Point p,
                         int index)

findTab

private Tab findTab(DraggableComponent draggableComponent)

checkIfOnlyOneTab

private void checkIfOnlyOneTab(boolean inc)

setTabAreaComponentsButtonsVisible

private void setTabAreaComponentsButtonsVisible()

calcScrollWidth

private int calcScrollWidth()

calcScrollHeight

private int calcScrollHeight()

updateScrollButtons

private void updateScrollButtons()

fireTabMoved

private void fireTabMoved(Tab tab)

fireDraggedEvent

private void fireDraggedEvent(Tab tab,
                              java.awt.event.MouseEvent mouseEvent)

fireDroppedEvent

private void fireDroppedEvent(Tab tab,
                              java.awt.event.MouseEvent mouseEvent)

fireNotDroppedEvent

private void fireNotDroppedEvent(Tab tab)

fireSelectedEvent

private void fireSelectedEvent(Tab tab,
                               Tab oldTab)

fireHighlightedEvent

private void fireHighlightedEvent(Tab tab,
                                  Tab oldTab)

fireAddedEvent

private void fireAddedEvent(Tab tab)

fireRemovedEvent

private void fireRemovedEvent(Tab tab)

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent event)
Overrides:
processMouseEvent in class javax.swing.JComponent

doProcessMouseEvent

void doProcessMouseEvent(java.awt.event.MouseEvent event)

doProcessMouseMotionEvent

void doProcessMouseMotionEvent(java.awt.event.MouseEvent event)

updateShadow

private void updateShadow()

updatePanelOpaque

private void updatePanelOpaque()