public final class TabDisplayer extends JComponent implements Accessible, Autoscroll
It has a three display modes (more fully described in the overview for TabbedContainer), to provide different styles of tab display, such as scrolling tabs and others.
TabDisplayer is completely model driven - the class itself is little more than an aggregation point for a data model, a selection model, and so forth. The logic that allows it to operate is implemented in the UI delegates, which are installed by (and can be replaced via) the standard Swing UIManager mechanisms.
Some TabDisplayer UI's support an orientation property, which is provided
via the client property PROP_ORIENTATION
.
Modifier and Type | Class and Description |
---|---|
protected class |
TabDisplayer.AccessibleTabDisplayer |
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static String |
COMMAND_CLOSE
Action command indicating that the action event signifies the user
clicking the Close button on a tab.
|
static String |
COMMAND_CLOSE_ALL
Action command indicating that the action event fired signifies the user
has shift-clicked the close button on a tab
|
static String |
COMMAND_CLOSE_ALL_BUT_THIS
Action command indicating that the action event fired signifies the user
has alt-clicked the close button on a tab
|
static String |
COMMAND_CLOSE_GROUP
Action command to close the whole window group.
|
static String |
COMMAND_DISABLE_AUTO_HIDE
Action command indicating that the action event signifies the user
clicking the Pin button on a tab.
|
static String |
COMMAND_ENABLE_AUTO_HIDE
Action command indicating that the action event signifies the user
clicking the Pin button on a tab.
|
static String |
COMMAND_MAXIMIZE
Action command indicating that the action event fired signifies the user
has double clicked a tab
|
static String |
COMMAND_MINIMIZE_GROUP
Action command to slide out the whole window group.
|
static String |
COMMAND_POPUP_REQUEST
Action command indicating that the action event fired signifies the user
requesting a popup menu over a tab
|
static String |
COMMAND_RESTORE_GROUP
Action command to restore the whole slided-out window group.
|
static String |
COMMAND_SELECT
Action command indicating that the action event fired signifies the user
selecting a tab
|
static String |
EDITOR_TAB_DISPLAYER_UI_CLASS_ID
UIManager key for the UI Delegate to be used for "editor" style TabbedContainers
|
static Object |
ORIENTATION_CENTER
Client property value for pin button to have neutral orientation
|
static Object |
ORIENTATION_EAST
Client property value to display tabs on the left side of the control.
|
static Object |
ORIENTATION_INVISIBLE
Client property value for pin button to be invisible
|
static Object |
ORIENTATION_NORTH
Client property value to display tabs on the top edge of the control
|
static Object |
ORIENTATION_SOUTH
Client property value to display tabs on the bottom edge of the control
|
static Object |
ORIENTATION_WEST
Client property value to display tabs on the right side of the control
|
static String |
PROP_ACTIVE
Property indicating the tab displayer should be painted as
"active".
|
static String |
PROP_ORIENTATION
Client property to indicate the orientation, which determines what
side the tabs are displayed on.
|
static String |
SLIDING_TAB_DISPLAYER_UI_CLASS_ID
UIManager key for the UI delegate to be used in "sliding" style
containers
|
static String |
TOOLBAR_TAB_DISPLAYER_UI_CLASS_ID
UIManager key for the UI delegate to be used for toolbar style tabs
|
static int |
TYPE_EDITOR
Displayer type for editor tabs, which scroll (typically - depends on what
the UI does).
|
static int |
TYPE_SLIDING |
static int |
TYPE_TOOLBAR |
static int |
TYPE_VIEW
Displayer type for view tabs, which do not scroll and simply divide the
available space between themselves.
|
static String |
VIEW_TAB_DISPLAYER_UI_CLASS_ID
UIManager key for the UI Delegate to be used for "view" style TabbedContainers
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
TabDisplayer() |
TabDisplayer(TabDataModel model,
int type)
Creates a new instance of TabDisplayer
|
TabDisplayer(TabDataModel model,
int type,
LocationInformer locationInformer)
Deprecated.
|
TabDisplayer(TabDataModel model,
int type,
WinsysInfoForTabbed winsysInfo)
Deprecated.
|
TabDisplayer(TabDataModel model,
int type,
WinsysInfoForTabbedContainer containerWinsysInfo)
Creates a new instance of TabDisplayer
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener listener)
Register an ActionListener.
|
void |
autoscroll(Point cursorLocn) |
void |
cancelRequestAttention(int tab)
Cause a tab, if blinking, to stop.
|
AccessibleContext |
getAccessibleContext() |
Insets |
getAutoscrollInsets() |
ComponentConverter |
getComponentConverter() |
WinsysInfoForTabbedContainer |
getContainerWinsysInfo() |
Image |
getDragImage(int index)
Deprecated.
|
Font |
getFont() |
LocationInformer |
getLocationInformer()
Deprecated.
|
Dimension |
getMinimumSize() |
TabDataModel |
getModel()
Get the data model that defines the contents which are displayed
|
Dimension |
getPreferredSize() |
SingleSelectionModel |
getSelectionModel()
Get the selection model, which determines which tab is selected.
|
Rectangle |
getTabRect(int tab,
Rectangle dest)
Get the rectangle that a given tab occupies
|
String |
getToolTipText(MouseEvent event)
Gets tooltip for the tab corresponding to the mouse event, or if no
tab, delegates to the default implementation.
|
int |
getType()
Returns whether this control uses the view tab look or the scrolling
editor tab look.
|
TabDisplayerUI |
getUI() |
String |
getUIClassID()
Returns an different UIClassID depending on the value of the
type
property. |
WinsysInfoForTabbed |
getWinsysInfo()
Deprecated.
|
boolean |
isActive()
Gets the "active" state of this component.
|
boolean |
isShowCloseButton()
Find out if this displayer is set to show close buttons
|
void |
makeTabVisible(int index)
Make a tab visible.
|
protected void |
postActionEvent(TabActionEvent event)
Notifies all registered listeners about the event.
|
void |
registerShortcuts(JComponent comp) |
void |
removeActionListener(ActionListener listener)
Removes ActionListener from the list of listeners.
|
void |
requestAttention(int tab)
Cause the specified tab to flash or otherwise call attention to itself
without changing selection or focus.
|
boolean |
requestAttention(TabData data) |
void |
setActive(boolean active)
Set the active state of the component
|
void |
setAttentionHighlight(int tab,
boolean highlight)
Turn tab highlight on/off
|
void |
setComponentConverter(ComponentConverter converter) |
void |
setShowCloseButton(boolean val)
Set whether or not the close button should be visible.
|
int |
tabForCoordinate(Point p) |
void |
unregisterShortcuts(JComponent comp) |
void |
updateUI()
Overridden to block the call from the superclass constructor, which
comes before the
type property is initialized. |
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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, 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
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, transferFocusDownCycle, validate, validateTree
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, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int TYPE_VIEW
public static final int TYPE_EDITOR
public static final int TYPE_SLIDING
public static final int TYPE_TOOLBAR
public static final String PROP_ACTIVE
public static final String COMMAND_CLOSE
public static final String COMMAND_SELECT
public static final String COMMAND_POPUP_REQUEST
public static final String COMMAND_MAXIMIZE
public static final String COMMAND_CLOSE_ALL
public static final String COMMAND_CLOSE_ALL_BUT_THIS
public static final String COMMAND_ENABLE_AUTO_HIDE
public static final String COMMAND_MINIMIZE_GROUP
public static final String COMMAND_RESTORE_GROUP
public static final String COMMAND_CLOSE_GROUP
public static final String COMMAND_DISABLE_AUTO_HIDE
public static final String EDITOR_TAB_DISPLAYER_UI_CLASS_ID
public static final String VIEW_TAB_DISPLAYER_UI_CLASS_ID
public static final String SLIDING_TAB_DISPLAYER_UI_CLASS_ID
public static final String TOOLBAR_TAB_DISPLAYER_UI_CLASS_ID
public static final String PROP_ORIENTATION
public static final Object ORIENTATION_EAST
public static final Object ORIENTATION_WEST
public static final Object ORIENTATION_NORTH
public static final Object ORIENTATION_SOUTH
public static final Object ORIENTATION_CENTER
public static final Object ORIENTATION_INVISIBLE
public TabDisplayer()
public TabDisplayer(TabDataModel model, int type)
@Deprecated public TabDisplayer(TabDataModel model, int type, LocationInformer locationInformer)
@Deprecated public TabDisplayer(TabDataModel model, int type, WinsysInfoForTabbed winsysInfo)
public TabDisplayer(TabDataModel model, int type, WinsysInfoForTabbedContainer containerWinsysInfo)
public final TabDisplayerUI getUI()
getUI
in class JComponent
public final void updateUI()
type
property is initialized. Provides
a reasonable fallback UI for use on unknown look and feels.updateUI
in class JComponent
public String getUIClassID()
type
property.getUIClassID
in class JComponent
public final int getType()
public final Dimension getPreferredSize()
getPreferredSize
in class JComponent
public final Font getFont()
getFont
in interface MenuContainer
getFont
in class Component
public final Dimension getMinimumSize()
getMinimumSize
in class JComponent
public final void requestAttention(int tab)
public final void cancelRequestAttention(int tab)
public final void setAttentionHighlight(int tab, boolean highlight)
tab
- public final boolean requestAttention(TabData data)
public SingleSelectionModel getSelectionModel()
public final TabDataModel getModel()
public final void setActive(boolean active)
public final boolean isActive()
public final String getToolTipText(MouseEvent event)
getToolTipText
in class JComponent
public final void makeTabVisible(int index)
public final Rectangle getTabRect(int tab, Rectangle dest)
@Deprecated public final Image getDragImage(int index)
public final void addActionListener(ActionListener listener)
listener
- The listener to register.public final void removeActionListener(ActionListener listener)
listener
- The listener to remove.public void registerShortcuts(JComponent comp)
public void unregisterShortcuts(JComponent comp)
protected final void postActionEvent(TabActionEvent event)
event
- The event to be firedpublic int tabForCoordinate(Point p)
@Deprecated public WinsysInfoForTabbed getWinsysInfo()
public WinsysInfoForTabbedContainer getContainerWinsysInfo()
@Deprecated public LocationInformer getLocationInformer()
public AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class Component
public final void setShowCloseButton(boolean val)
nb.tabs.suppressCloseButton
. The default is
true.public final boolean isShowCloseButton()
public void setComponentConverter(ComponentConverter converter)
public ComponentConverter getComponentConverter()
public Insets getAutoscrollInsets()
getAutoscrollInsets
in interface Autoscroll
public void autoscroll(Point cursorLocn)
autoscroll
in interface Autoscroll