站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

TabDisplayer (Tab Control) - NetBeans API Javadoc (Current Development Version)

org.netbeans.swing.tabcontrol 1.8

org.netbeans.swing.tabcontrol
Class TabDisplayer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by org.netbeans.swing.tabcontrol.TabDisplayer
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public final class TabDisplayer
extends JComponent
implements Accessible

A Component which displays tabs supplied by a TabDataModel. This is essentially the upper (or lower) portion of a tabbed pane, without the part that displays components. It can be used to provide tab-like selection over a data model containing anything, not just components.

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.

See Also:
Serialized Form

Nested Class Summary
protected  class TabDisplayer.AccessibleTabDisplayer
           
 
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.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
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_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_POPUP_REQUEST
          Action command indicating that the action event fired signifies the user requesting a popup menu over a tab
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
 
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
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)
          Creates a new instance of TabDisplayer
 
Method Summary
 void addActionListener(ActionListener listener)
          Register an ActionListener.
 void cancelRequestAttention(int tab)
          Cause a tab, if blinking, to stop.
 AccessibleContext getAccessibleContext()
           
 Image getDragImage(int index)
          Deprecated. 
 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()
           
 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 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.
 
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, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, 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
 
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

TYPE_VIEW

public static final int TYPE_VIEW
Displayer type for view tabs, which do not scroll and simply divide the available space between themselves. The value of this field is mapped to TabbedContainer.TYPE_VIEW

See Also:
Constant Field Values

TYPE_EDITOR

public static final int TYPE_EDITOR
Displayer type for editor tabs, which scroll (typically - depends on what the UI does). The value of this field is mapped to TabbedContainer.TYPE_EDITOR

See Also:
Constant Field Values

TYPE_SLIDING

public static final int TYPE_SLIDING
See Also:
Constant Field Values

TYPE_TOOLBAR

public static final int TYPE_TOOLBAR
See Also:
Constant Field Values

PROP_ACTIVE

public static final String PROP_ACTIVE
Property indicating the tab displayer should be painted as "active". This is typically used to indicate keyboard focus. The valud of this field is mapped to TabbedContainer.PROP_ACTIVE

See Also:
Constant Field Values

COMMAND_CLOSE

public static final String COMMAND_CLOSE
Action command indicating that the action event signifies the user clicking the Close button on a tab.

See Also:
Constant Field Values

COMMAND_SELECT

public static final String COMMAND_SELECT
Action command indicating that the action event fired signifies the user selecting a tab

See Also:
Constant Field Values

COMMAND_POPUP_REQUEST

public static final String COMMAND_POPUP_REQUEST
Action command indicating that the action event fired signifies the user requesting a popup menu over a tab

See Also:
Constant Field Values

COMMAND_MAXIMIZE

public static final String COMMAND_MAXIMIZE
Action command indicating that the action event fired signifies the user has double clicked a tab

See Also:
Constant Field Values

COMMAND_CLOSE_ALL

public static final String COMMAND_CLOSE_ALL
Action command indicating that the action event fired signifies the user has shift-clicked the close button on a tab

See Also:
Constant Field Values

COMMAND_CLOSE_ALL_BUT_THIS

public static final 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

See Also:
Constant Field Values

COMMAND_ENABLE_AUTO_HIDE

public static final String COMMAND_ENABLE_AUTO_HIDE
Action command indicating that the action event signifies the user clicking the Pin button on a tab.

See Also:
Constant Field Values

COMMAND_DISABLE_AUTO_HIDE

public static final String COMMAND_DISABLE_AUTO_HIDE
Action command indicating that the action event signifies the user clicking the Pin button on a tab.

See Also:
Constant Field Values

EDITOR_TAB_DISPLAYER_UI_CLASS_ID

public static final String EDITOR_TAB_DISPLAYER_UI_CLASS_ID
UIManager key for the UI Delegate to be used for "editor" style TabbedContainers

See Also:
Constant Field Values

VIEW_TAB_DISPLAYER_UI_CLASS_ID

public static final String VIEW_TAB_DISPLAYER_UI_CLASS_ID
UIManager key for the UI Delegate to be used for "view" style TabbedContainers

See Also:
Constant Field Values

SLIDING_TAB_DISPLAYER_UI_CLASS_ID

public static final String SLIDING_TAB_DISPLAYER_UI_CLASS_ID
UIManager key for the UI delegate to be used in "sliding" style containers

See Also:
Constant Field Values

TOOLBAR_TAB_DISPLAYER_UI_CLASS_ID

public static final String TOOLBAR_TAB_DISPLAYER_UI_CLASS_ID
UIManager key for the UI delegate to be used for toolbar style tabs

See Also:
Constant Field Values

PROP_ORIENTATION

public static final String PROP_ORIENTATION
Client property to indicate the orientation, which determines what side the tabs are displayed on. Currently this is only honored by the sliding tabs ui delegate.

See Also:
Constant Field Values

ORIENTATION_EAST

public static final Object ORIENTATION_EAST
Client property value to display tabs on the left side of the control.


ORIENTATION_WEST

public static final Object ORIENTATION_WEST
Client property value to display tabs on the right side of the control


ORIENTATION_NORTH

public static final Object ORIENTATION_NORTH
Client property value to display tabs on the top edge of the control


ORIENTATION_SOUTH

public static final Object ORIENTATION_SOUTH
Client property value to display tabs on the bottom edge of the control


ORIENTATION_CENTER

public static final Object ORIENTATION_CENTER
Client property value for pin button to have neutral orientation


ORIENTATION_INVISIBLE

public static final Object ORIENTATION_INVISIBLE
Client property value for pin button to be invisible

Constructor Detail

TabDisplayer

public TabDisplayer()

TabDisplayer

public TabDisplayer(TabDataModel model,
                    int type)
Creates a new instance of TabDisplayer


TabDisplayer

@Deprecated
public TabDisplayer(TabDataModel model,
                               int type,
                               LocationInformer locationInformer)
Deprecated. 

Depreacated, please use constructor with WinsysInfoForTabbed param.


TabDisplayer

public TabDisplayer(TabDataModel model,
                    int type,
                    WinsysInfoForTabbed winsysInfo)
Creates a new instance of TabDisplayer

Method Detail

getUI

public final TabDisplayerUI getUI()

updateUI

public final void updateUI()
Overridden to block the call from the superclass constructor, which comes before the type property is initialized. Provides a reasonable fallback UI for use on unknown look and feels.

Overrides:
updateUI in class JComponent

getUIClassID

public String getUIClassID()
Returns an different UIClassID depending on the value of the type property.

Overrides:
getUIClassID in class JComponent

getType

public final int getType()
Returns whether this control uses the view tab look or the scrolling editor tab look. This is set in the constructor.


getPreferredSize

public final Dimension getPreferredSize()
Overrides:
getPreferredSize in class JComponent

getMinimumSize

public final Dimension getMinimumSize()
Overrides:
getMinimumSize in class JComponent

requestAttention

public final void requestAttention(int tab)
Cause the specified tab to flash or otherwise call attention to itself without changing selection or focus. Supported by VIEW and EDITOR type UIs.


cancelRequestAttention

public final void cancelRequestAttention(int tab)
Cause a tab, if blinking, to stop.


requestAttention

public final boolean requestAttention(TabData data)

getSelectionModel

public SingleSelectionModel getSelectionModel()
Get the selection model, which determines which tab is selected. To change the selection, get the selection model and call setSelectedIndex().


getModel

public final TabDataModel getModel()
Get the data model that defines the contents which are displayed


setActive

public final void setActive(boolean active)
Set the active state of the component


isActive

public final boolean isActive()
Gets the "active" state of this component. If the component is active, most UIs will paint the selected tab differently to indicate that focus is somewhere in the container


getToolTipText

public final String getToolTipText(MouseEvent event)
Gets tooltip for the tab corresponding to the mouse event, or if no tab, delegates to the default implementation.

Overrides:
getToolTipText in class JComponent

makeTabVisible

public final void makeTabVisible(int index)
Make a tab visible. In the case of scrolling UIs, a tab is not always visible. This call will make it scroll into view


getTabRect

public final Rectangle getTabRect(int tab,
                                  Rectangle dest)
Get the rectangle that a given tab occupies


getDragImage

@Deprecated
public final Image getDragImage(int index)
Deprecated. 


addActionListener

public final void addActionListener(ActionListener listener)
Register an ActionListener. TabbedContainer and TabDisplayer guarantee that the type of event fired will always be TabActionEvent. There are two special things about TabActionEvent:
  1. There are methods on TabActionEvent to find the index of the tab the event was performed on, and if present, retrieve the mouse event that triggered it, for clients that wish to provide different handling for different mouse buttons
  2. TabActionEvents can be consumed. If a listener consumes the event, the UI will take no action - the selection will not be changed, the tab will not be closed. Consuming the event means taking responsibility for doing whatever would normally happen automatically. This is useful for, for example, showing a dialog and possibly aborting closing a tab if it contains unsaved data, for instance.
Action events will be fired before any action has been taken to alter the state of the control to match the action, so that they may be vetoed or modified by consuming the event.

Parameters:
listener - The listener to register.

removeActionListener

public final void removeActionListener(ActionListener listener)
Removes ActionListener from the list of listeners.

Parameters:
listener - The listener to remove.

registerShortcuts

public void registerShortcuts(JComponent comp)

unregisterShortcuts

public void unregisterShortcuts(JComponent comp)

postActionEvent

protected final void postActionEvent(TabActionEvent event)
Notifies all registered listeners about the event.

Parameters:
event - The event to be fired

tabForCoordinate

public int tabForCoordinate(Point p)

getWinsysInfo

public WinsysInfoForTabbed getWinsysInfo()

getLocationInformer

@Deprecated
public LocationInformer getLocationInformer()
Deprecated. 


getAccessibleContext

public AccessibleContext getAccessibleContext()
Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in class JComponent

setShowCloseButton

public final void setShowCloseButton(boolean val)
Set whether or not the close button should be visible. This can be defaulted by setting the system property nb.tabs.suppressCloseButton. The default is true.


isShowCloseButton

public final boolean isShowCloseButton()
Find out if this displayer is set to show close buttons


org.netbeans.swing.tabcontrol 1.8

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.