Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

oracle.ide.controls
Class ScrollableTabBar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by oracle.ide.controls.ScrollableTabBar
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public final class ScrollableTabBar
extends javax.swing.JComponent

A component that provides support for a row of tabs (implemented using CustomTab) with buttons that can be used to scroll between the tabs and access a drop down menu containing a list of all tabs.

The way in which scrolling works in the bar may be controlled using the scrollMode property. The component can support a scrolling mode which switches between tabs when the user clicks the left and right buttons, or a mode where the area containing the tabs is paged much like a scrollable view port.

You can programmatically display the drop down menu containing the list of tabs using the showDropDownMenu() method.

You can install a custom component into the tab bar. The custom component will be positioned between the tabs and the tab switching controls, and will take any remaining horizontal space available. This area is used by many consumers of this class to host a horizontal scrollbar for the component(s) being controlled by the tabs.

You can control whether or not the tab area will disappear when only one tab is visible using the setHideSingleTab(boolean) method. By default, the tab area is always visible.

Since:
11.0
See Also:
Serialized Form

Nested Class Summary
static class ScrollableTabBar.ScrollMode
          The behavior of the scroll left / right buttons.
 
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
 
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
ScrollableTabBar()
          Constructs a ScrollableTabBar.
ScrollableTabBar(int position)
          Constructs a ScrollableTabBar.
 
Method Summary
 void doLayout()
           
 void ensureSelectedTabVisible()
          Ensures that the selected tab is visible.
 java.awt.Component getCustomComponent()
          Gets the custom component.
 boolean getHideSingleTab()
          Gets whether the tab area is hidden if there is only a single tab.
 java.awt.Dimension getPreferredSize()
           
 ScrollableTabBar.ScrollMode getScrollMode()
          Gets the behavior of the left and right scroll buttons.
 CustomTab getTabs()
          Gets the tabs.
protected  void paintComponent(java.awt.Graphics g)
           
 void removeScrollButtons()
          Removes the scroll buttons
 void setCustomComponent(java.awt.Component customComponent)
          Sets the custom component to install between the tabs and the scroll buttons.
 void setHideSingleTab(boolean hideSingleTab)
          Sets whether the tab area is hidden if there is only a single tab.
 void setScrollMode(ScrollableTabBar.ScrollMode mode)
          Controls the behavior of the left and right scroll buttons.
 void showDropDownMenu()
          Programmatically makes the drop down menu containing the list of tabs visible.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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
 

Constructor Detail

ScrollableTabBar

public ScrollableTabBar()
Constructs a ScrollableTabBar. with the tabs at the bottom


ScrollableTabBar

public ScrollableTabBar(int position)
Constructs a ScrollableTabBar. with the tabs at the specified position

Parameters:
position - SwingConstants.TOP or SwingConstants.BOTTOM
Method Detail

removeScrollButtons

public void removeScrollButtons()
Removes the scroll buttons


setHideSingleTab

public void setHideSingleTab(boolean hideSingleTab)
Sets whether the tab area is hidden if there is only a single tab. If true, the tab bar's preferred size will become zero as soon as only one tab is present.

This property is false by default.

Parameters:
hideSingleTab - if true, the tab bar is hidden if only one tab exists.

getHideSingleTab

public boolean getHideSingleTab()
Gets whether the tab area is hidden if there is only a single tab.

Returns:
true if the tab area is hidden if there is only a single tab.

setCustomComponent

public void setCustomComponent(java.awt.Component customComponent)
Sets the custom component to install between the tabs and the scroll buttons.

Parameters:
customComponent - a custom component to install. You may pass null into this method, which removes any existing custom component.

getCustomComponent

public java.awt.Component getCustomComponent()
Gets the custom component.

Returns:
the installed custom component, or null if no custom component has been installed.

getTabs

public CustomTab getTabs()
Gets the tabs. This is a read only property.

Returns:
the tabs. Will never return null.

setScrollMode

public void setScrollMode(ScrollableTabBar.ScrollMode mode)
Controls the behavior of the left and right scroll buttons.

Parameters:
mode - the scroll mode.
See Also:
ScrollableTabBar.ScrollMode

getScrollMode

public ScrollableTabBar.ScrollMode getScrollMode()
Gets the behavior of the left and right scroll buttons.

Returns:
the behavior of the left and right scroll buttons.

showDropDownMenu

public void showDropDownMenu()
Programmatically makes the drop down menu containing the list of tabs visible.


ensureSelectedTabVisible

public void ensureSelectedTabVisible()
Ensures that the selected tab is visible. Will scroll the selected tab into view.


doLayout

public void doLayout()
Overrides:
doLayout in class java.awt.Container

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.1.0)

E17493-02

Copyright © 1997, 2011, Oracle. All rights reserved.