public class JTabbedPane extends JComponent implements Serializable, Accessible, SwingConstants
 标签/组件通过使用addTab和insertTab方法添加到TabbedPane对象。 选项卡由与其添加的位置对应的索引表示,其中第一个选项卡的索引等于0,最后一个选项卡的索引等于制表符计数减1。 
 TabbedPane使用SingleSelectionModel来表示一组选项卡索引和当前选择的索引。 如果选项卡计数大于0,那么将始终有一个选定的索引,默认情况下将其初始化为第一个选项卡。 如果选项卡计数为0,则所选索引将为-1。 
 选项卡标题可以由Component呈现。 例如,以下产生类似的结果: 
  // In this case the look and feel renders the title for the tab.
 tabbedPane.addTab("Tab", myComponent);
 // In this case the custom component is responsible for rendering the
 // title of the tab.
 tabbedPane.addTab(null, myComponent);
 tabbedPane.setTabComponentAt(0, new JLabel("Tab"));  
       当需要更复杂的用户交互需要自定义组件时,通常会使用后者。 
       例如,您可以提供一个动画的自定义组件或具有关闭选项卡的小部件的组件。 
        如果您为选项卡指定组件, JTabbedPane将不会呈现您为该选项卡指定的任何文本或图标。 
 注意:不要使用setVisible直接在标签成分以使其可见,使用setSelectedComponent或setSelectedIndex方法来代替。 
警告: Swing不是线程安全的。 有关更多信息,请参阅Swing's Threading Policy 。
 警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,对所有JavaBeans的长期存储的支持已被添加到java.beans包中。 请参阅XMLEncoder 。 
SingleSelectionModel 
       | Modifier and Type | Class and Description | 
|---|---|
| protected class  | JTabbedPane.AccessibleJTabbedPane
              这个类实现了可访问性支持 
              JTabbedPane类。 | 
| protected class  | JTabbedPane.ModelListener
              我们通过 
              ModelChanged页(而不是模型本身)将ModelChanged事件传递给ModelChanged作为事件源。 | 
JComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description | 
|---|---|
| protected ChangeEvent | changeEvent
              每个 
              TabPane实例只需要一个ChangeEvent,因为事件的唯一(只读)状态是源属性。 | 
| protected ChangeListener | changeListenerchangeListener是我们添加到模型的监听器。 | 
| protected SingleSelectionModel | model
              默认选择模型 
             | 
| static int | SCROLL_TAB_LAYOUT
              选项卡布局策略,用于在所有选项卡不适合单个运行时提供可用选项卡的子集。 
             | 
| protected int | tabPlacement
              放置标签的位置 
             | 
| static int | WRAP_TAB_LAYOUT
              当所有选项卡不适合单个运行时,用于在多个运行中包装选项卡的选项卡布局策略。 
             | 
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WESTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description | 
|---|
| JTabbedPane()
              创建一个空的 
              TabbedPane,默认标签位置为JTabbedPane.TOP。 | 
| JTabbedPane(int tabPlacement)
              创建空 
              TabbedPane与任一指定的选项卡放置:JTabbedPane.TOP,JTabbedPane.BOTTOM,JTabbedPane.LEFT,或JTabbedPane.RIGHT。 | 
| JTabbedPane(int tabPlacement, int tabLayoutPolicy)
              使用指定的选项卡布局和制表符布局策略创建一个空的 
              TabbedPane。 | 
| Modifier and Type | Method and Description | 
|---|---|
| Component | add(Component component)
              添加一个 
              component与选项卡标题默认为组件的名称,这是调用component.getName的结果。 | 
| Component | add(Component component, int index)
              在指定的选项卡索引中添加一个 
              component,其中的选项卡标题默认为组件的名称。 | 
| void | add(Component component, Object constraints)
              在选项卡窗格中添加一个 
              component。 | 
| void | add(Component component, Object constraints, int index)
              在指定的选项卡索引中添加一个 
              component。 | 
| Component | add(String title, Component component)
              添加一个 
              component与指定的选项卡标题。 | 
| void | addChangeListener(ChangeListener l)
              添加一个 
              ChangeListener为此tabbedpane。 | 
| void | addTab(String title, Component component)
              添加一个 
              component代表的title和没有图标。 | 
| void | addTab(String title, Icon icon, Component component)
              增加了一个 
              component由a表示title和/或icon,其中任一个可以是null。 | 
| void | addTab(String title, Icon icon, Component component, String tip)
              增加了一个 
              component和tip由a表示title和/或icon,其中任一个可以是null。 | 
| protected ChangeListener | createChangeListener()
              要处理 
              ChangeEvents不同的子类可以覆盖此值以返回ModelListener或另一个ChangeListener实现的子类。 | 
| protected void | fireStateChanged()
              发送一个 
              ChangeEvent,以JTabbedPane为源,给每个注册的听众。 | 
| AccessibleContext | getAccessibleContext()
              获取与此JTabbedPane关联的AccessibleContext。 
             | 
| Color | getBackgroundAt(int index)
              返回标签背景颜色为 
              index。 | 
| Rectangle | getBoundsAt(int index)
              返回标签边界 
              index。 | 
| ChangeListener[] | getChangeListeners()
              返回所有 
              ChangeListener的数组,添加到JTabbedPane与addChangeListener。 | 
| Component | getComponentAt(int index)
              返回index的 
              index。 | 
| Icon | getDisabledIconAt(int index)
              返回 
              index的标签禁用图标。 | 
| int | getDisplayedMnemonicIndexAt(int tabIndex)
              返回字符,作为索引,外观和感觉应提供装饰用于表示助记符。 
             | 
| Color | getForegroundAt(int index)
              返回标签前景色为 
              index。 | 
| Icon | getIconAt(int index)
              返回 
              index的标签图标。 | 
| int | getMnemonicAt(int tabIndex)
              返回用于访问指定选项卡的键盘助记符。 
             | 
| SingleSelectionModel | getModel()
              返回与此选项卡窗格关联的模型。 
             | 
| Component | getSelectedComponent()
              返回此选项卡窗格当前选定的组件。 
             | 
| int | getSelectedIndex()
              返回此选项卡窗格的当前选择的索引。 
             | 
| Component | getTabComponentAt(int index)
              返回标签组件 
              index。 | 
| int | getTabCount()
              返回此 
              tabbedpane中的选项卡数。 | 
| int | getTabLayoutPolicy()
              当所有选项卡不适合单个运行时,返回标签页窗口用于布局选项卡的策略。 
             | 
| int | getTabPlacement()
              返回此标签页窗格的标签页的位置。 
             | 
| int | getTabRunCount()
              返回当前用于显示选项卡的选项卡运行次数。 
             | 
| String | getTitleAt(int index)
              返回标签标题 
              index。 | 
| String | getToolTipText(MouseEvent event)
              返回由鼠标事件位置确定的组件的工具提示文本。 
             | 
| String | getToolTipTextAt(int index)
              返回标签工具提示文字 
              index。 | 
| TabbedPaneUI | getUI()
              返回实现该组件的L&F的UI对象。 
             | 
| String | getUIClassID()
              返回实现该组件的L&F的UI类的名称。 
             | 
| int | indexAtLocation(int x, int y)
              返回与其边界与指定位置相交的选项卡对应的选项卡索引。 
             | 
| int | indexOfComponent(Component component)
              返回指定组件的选项卡的索引。 
             | 
| int | indexOfTab(Icon icon)
              返回具有给定 
              icon的第一个选项卡索引,如果没有选项卡具有此图标,则返回-1。 | 
| int | indexOfTab(String title)
              返回具有给定 
              title的第一个选项卡索引,如果没有选项卡具有此标题,则返回-1。 | 
| int | indexOfTabComponent(Component tabComponent)
              返回指定选项卡组件的选项卡的索引。 
             | 
| void | insertTab(String title, Icon icon, Component component, String tip, int index)
              在给定的索引上插入给定组件的新选项卡,由给定的标题和/或图标表示,其中任一个可能为 
              null。 | 
| boolean | isEnabledAt(int index)
              返回当前是否启用 
              index的选项卡。 | 
| protected String | paramString()
              返回此 
              JTabbedPane的字符串表示JTabbedPane。 | 
| void | remove(Component component)
              删除指定的 
              Component从JTabbedPane。 | 
| void | remove(int index)
              删除与指定索引对应的选项卡和组件。 
             | 
| void | removeAll()
              从 
              tabbedpane中删除所有选项卡及其相应的tabbedpane。 | 
| void | removeChangeListener(ChangeListener l)
              从此 
              ChangeListener中移除ChangeListener。 | 
| void | removeTabAt(int index)
              删除该选项卡 
              index。 | 
| void | setBackgroundAt(int index, Color background)
              在设置背景颜色 
              index到background可以是null,在这种情况下选项卡的背景色默认为背景颜色tabbedpane。 | 
| void | setComponentAt(int index, Component component)
              将组件设置为 
              index至component。 | 
| void | setDisabledIconAt(int index, Icon disabledIcon)
              将禁用的图标设置为 
              index至icon,可以是null。 | 
| void | setDisplayedMnemonicIndexAt(int tabIndex, int mnemonicIndex)
              提供关于文字中哪个字符应该被装饰以表示助记符的外观和感觉的提示。 
             | 
| void | setEnabledAt(int index, boolean enabled)
              设置是否启用 
              index的选项卡。 | 
| void | setForegroundAt(int index, Color foreground)
              将前景色设置为 
              index至foreground,可以为null,在这种情况下,标签的前景色将默认为此tabbedpane。 | 
| void | setIconAt(int index, Icon icon)
              将图标设置为 
              index至icon,可以是null。 | 
| void | setMnemonicAt(int tabIndex, int mnemonic)
              设置用于访问指定选项卡的键盘助记符。 
             | 
| void | setModel(SingleSelectionModel model)
              设置要与此选项卡窗格一起使用的模型。 
             | 
| void | setSelectedComponent(Component c)
              设置此选项卡窗格的选定组件。 
             | 
| void | setSelectedIndex(int index)
              设置此选项卡窗格的所选索引。 
             | 
| void | setTabComponentAt(int index, Component component)
              设置负责渲染指定选项卡的标题的组件。 
             | 
| void | setTabLayoutPolicy(int tabLayoutPolicy)
              设置当所有选项卡不适合单个运行时,选项卡窗格将用于布局选项卡的策略。 
             | 
| void | setTabPlacement(int tabPlacement)
              设置此标签页窗格的标签位置。 
             | 
| void | setTitleAt(int index, String title)
              将标题设置为 
              index至title,可以为null。 | 
| void | setToolTipTextAt(int index, String toolTipText)
              将工具提示文本设置为 
              index至toolTipText,可以为null。 | 
| void | setUI(TabbedPaneUI ui)
              设置实现该组件的L&F的UI对象。 
             | 
| void | updateUI()
              将UI属性重置为当前外观的值。 
             | 
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, updateaddContainerListener, 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, transferFocusDownCycle, validate, validateTreeaction, 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, 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, transferFocusBackward, transferFocusUpCyclepublic static final int WRAP_TAB_LAYOUT
public static final int SCROLL_TAB_LAYOUT
protected int tabPlacement
setTabPlacement(int) 
           protected SingleSelectionModel model
protected ChangeListener changeListener
changeListener是我们添加到模型的监听器。 
          protected transient ChangeEvent changeEvent
TabPane实例只需要一个ChangeEvent ,因为事件的唯一(只读)状态是源属性。 
           这里产生的事件的来源总是“这”。 
          public JTabbedPane()
TabbedPane ,默认标签位置为 
           JTabbedPane.TOP 。 
          public JTabbedPane(int tabPlacement)
TabbedPane与任一指定的选项卡放置: 
           JTabbedPane.TOP , 
           JTabbedPane.BOTTOM , 
           JTabbedPane.LEFT ,或 
           JTabbedPane.RIGHT 。 
          tabPlacement - 选项卡相对于内容的位置 
           addTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String) 
           public JTabbedPane(int tabPlacement,
                   int tabLayoutPolicy) 
          TabbedPane与指定的选项卡布局和选项卡布局策略。 
           标签位置可以是: JTabbedPane.TOP , JTabbedPane.BOTTOM , JTabbedPane.LEFT ,或JTabbedPane.RIGHT 。 
           标签布局策略可以是: JTabbedPane.WRAP_TAB_LAYOUT或JTabbedPane.SCROLL_TAB_LAYOUT 。 
          tabPlacement - 选项卡相对于内容的位置 
           tabLayoutPolicy - 当所有选项卡都不适合运行时,设置选项卡的策略 
           IllegalArgumentException - 如果选项卡布局或制表符布局策略不是上述支持的值之一 
           addTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String) 
           public TabbedPaneUI getUI()
TabbedPaneUI对象 
           setUI(javax.swing.plaf.TabbedPaneUI) 
           public void setUI(TabbedPaneUI ui)
ui - 新的UI对象 
           UIDefaults.getUI(javax.swing.JComponent) 
           public void updateUI()
updateUI在类 
            JComponent 
           JComponent.updateUI() 
           public String getUIClassID()
getUIClassID在 
            JComponent 
           JComponent.getUIClassID() , 
            UIDefaults.getUI(javax.swing.JComponent) 
           protected ChangeListener createChangeListener()
ChangeEvents的子类可以覆盖此值以返回 
           ModelListener或另一个 
           ChangeListener实现的子类。 
          fireStateChanged() 
           public void addChangeListener(ChangeListener l)
ChangeListener为此tabbedpane。 
          l - 
            ChangeListener添加 
           fireStateChanged() , 
            removeChangeListener(javax.swing.event.ChangeListener) 
           public void removeChangeListener(ChangeListener l)
ChangeListener中移除ChangeListener。 
          l - 要删除的 
            ChangeListener 
           fireStateChanged() , 
            addChangeListener(javax.swing.event.ChangeListener) 
           public ChangeListener[] getChangeListeners()
ChangeListener的数组,添加到 
           JTabbedPane与 
           addChangeListener 。 
          ChangeListener添加了,或者如果没有添加侦听器,则为空数组 
           protected void fireStateChanged()
ChangeEvent ,以JTabbedPane作为源,给每个注册的听众。 
           每次在JTabbedPane中对所选索引或所选标签进行更改时,将调用此方法。 
           通常,所选索引和选定的选项卡一起更改。 
           但是,在某些情况下,如选项卡添加,所选索引更改和相同选项卡仍然选中。 
           还有其他情况,例如删除所选标签,其中索引保持不变,但是新的选项卡移动到该索引。 
           所有这些情况都会触发事件。 
          public SingleSelectionModel getModel()
public void setModel(SingleSelectionModel model)
model - 要使用的模型 
           getModel() 
           public int getTabPlacement()
setTabPlacement(int) 
           public void setTabPlacement(int tabPlacement)
JTabbedPane.TOP JTabbedPane.BOTTOM JTabbedPane.LEFT JTabbedPane.RIGHT SwingConstants.TOP 。 
          tabPlacement - 选项卡相对于内容的位置 
           IllegalArgumentException - 如果选项卡布局值不是上述有效值之一 
           public int getTabLayoutPolicy()
setTabLayoutPolicy(int) 
           public void setTabLayoutPolicy(int tabLayoutPolicy)
JTabbedPane.WRAP_TAB_LAYOUT JTabbedPane.SCROLL_TAB_LAYOUT JTabbedPane.WRAP_TAB_LAYOUT 。 
           某些外观和感觉可能只支持可能的布局策略的一个子集,在这种情况下,此属性的值可能会被忽略。
tabLayoutPolicy - 用于布局选项卡的策略 
           IllegalArgumentException - 如果layoutPolicy值不是上述有效值之一 
           getTabLayoutPolicy() 
           public int getSelectedIndex()
setSelectedIndex(int) 
           public void setSelectedIndex(int index)
index - 要选择的索引 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < -1 || index >= tab count) 
           getSelectedIndex() , 
            SingleSelectionModel.setSelectedIndex(int) 
           public Component getSelectedComponent()
null 。 
          setSelectedComponent(java.awt.Component) 
           public void setSelectedComponent(Component c)
selectedIndex对应的索引。 
          IllegalArgumentException - 如果在选项卡窗格中找不到组件 
           getSelectedComponent() 
           public void insertTab(String title, Icon icon, Component component, String tip, int index)
null 。 
          title - 标签上显示的标题 
           icon - 要在标签上显示的图标 
           component - 单击此选项卡时要显示的组件。 
           tip - 要为此选项卡显示的工具提示 
           index - 插入新标签的位置( 
            > 0 and <= getTabCount() ) 
           IndexOutOfBoundsException - 如果索引超出范围( 
            < 0 or > getTabCount() ) 
           addTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String) , 
            removeTabAt(int) 
           public void addTab(String title, Icon icon, Component component, String tip)
component和tip由a表示title和/或icon ,其中任一个可以是null 。 
           封面方法为insertTab 。 
          title - 要在此选项卡中显示的标题 
           icon - 要在此选项卡中显示的图标 
           component - 单击此选项卡时要显示的组件 
           tip - 要显示此选项卡的工具提示 
           insertTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String, int) , 
            removeTabAt(int) 
           public void addTab(String title, Icon icon, Component component)
component由a表示title和/或icon ,其中任一个可以是null 。 
           封面方法为insertTab 。 
          title - 此选项卡中显示的标题 
           icon - 要在此选项卡中显示的图标 
           component - 单击此选项卡时要显示的组件 
           insertTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String, int) , 
            removeTabAt(int) 
           public void addTab(String title, Component component)
component代表一个title和没有图标。 
           封面方法为insertTab 。 
          title - 要在此选项卡中显示的标题 
           component - 单击此选项卡时要显示的组件 
           insertTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String, int) , 
            removeTabAt(int) 
           public Component add(Component component)
component与选项卡标题默认为组件的名称,这是调用component.getName的结果。 
           封面方法为insertTab 。 
          add在 
            Container 
           component - 单击此选项卡时要显示的组件 
           insertTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String, int) , 
            removeTabAt(int) 
           public Component add(String title, Component component)
component与指定的选项卡标题。 
           封面方法insertTab 。 
          add在 
            Container 
           title - 此选项卡中显示的标题 
           component - 单击此选项卡时要显示的组件 
           insertTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String, int) , 
            removeTabAt(int) 
           public Component add(Component component, int index)
component ,其中的选项卡标题默认为组件的名称。 
           封面方法为insertTab 。 
          add在 
            Container 
           component - 单击此选项卡时要显示的组件 
           index - 插入这个新标签的位置 
           insertTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String, int) , 
            removeTabAt(int) 
           public void add(Component component, Object constraints)
component 。 
           如果constraints是String或Icon ,它将用于选项卡标题,否则组件的名称将用作选项卡标题。 
           封面方法为insertTab 。 
          add在 
            Container 
           component - 单击此选项卡时要显示的组件 
           constraints - 要在选项卡中显示的对象 
           insertTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String, int) , 
            removeTabAt(int) 
           public void add(Component component, Object constraints, int index)
component 。 
           如果constraints是String或Icon ,它将用于选项卡标题,否则组件的名称将用作选项卡标题。 
           封面方法为insertTab 。 
          add在 
            Container 
           component - 单击此选项卡时要显示的组件 
           constraints - 要在选项卡中显示的对象 
           index - 插入这个新标签的位置 
           insertTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String, int) , 
            removeTabAt(int) 
           public void removeTabAt(int index)
index 。 
           删除与index关联的index后,其可见性将重置为true,以确保在添加到其他容器时可见。 
          index - 要删除的标签的索引 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           addTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String) , 
            insertTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String, int) 
           public void remove(Component component)
Component从JTabbedPane 。 
           如果component为null,该方法不执行任何操作。 
          remove在 
            Container 
           component - 从标签式窗格中移除的组件 
           addTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String) , 
            removeTabAt(int) 
           public void remove(int index)
remove在 
            Container 
           index - 要从tabbedpane删除的 
            tabbedpane 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           addTab(java.lang.String, javax.swing.Icon, java.awt.Component, java.lang.String) , 
            removeTabAt(int) 
           public void removeAll()
tabbedpane删除所有选项卡及其相应的 
           tabbedpane 。 
          public int getTabCount()
tabbedpane中的选项卡数。 
          public int getTabRunCount()
tabPlacement是 
            TOP或 
            BOTTOM ,如果 
            tabPlacement是 
            LEFT或 
            RIGHT ,则列数如果没有设置此 
            tabbedpane UI 
           public String getTitleAt(int index)
index 。 
          index - 被查询的项目的索引 
           index 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           setTitleAt(int, java.lang.String) 
           public Icon getIconAt(int index)
index 。 
          index - 正在查询的项目的索引 
           index 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           setIconAt(int, javax.swing.Icon) 
           public Icon getDisabledIconAt(int index)
index的标签禁用图标。 
           如果标签禁用图标不存在于index ,则会将调用转发到外观,从相应的启用图标构建适当的禁用图标。 
           有些看起来和感觉可能不会渲染残疾人图标,在这种情况下,它不会被创建。 
          index - 正在查询的项目的索引 
           index 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           setDisabledIconAt(int, javax.swing.Icon) 
           public String getToolTipTextAt(int index)
index 。 
          index - 要查询的项目的索引 
           index 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           setToolTipTextAt(int, java.lang.String) 
           public Color getBackgroundAt(int index)
index 。 
          index - 要查询的项目的索引 
           Color的选项卡背景为 
            index 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           setBackgroundAt(int, java.awt.Color) 
           public Color getForegroundAt(int index)
index 。 
          index - 要查询的项目的索引 
           Color的选项卡前景为 
            index 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           setForegroundAt(int, java.awt.Color) 
           public boolean isEnabledAt(int index)
index的选项卡。 
          index - 被查询的项目的索引 
           index的选项卡, index true; 
            否则为假 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           setEnabledAt(int, boolean) 
           public Component getComponentAt(int index)
index 。 
          index - 要查询的项目的索引 
           Component在 
            index 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           setComponentAt(int, java.awt.Component) 
           public int getMnemonicAt(int tabIndex)
tabIndex - 助记符所指的标签的索引 
           IndexOutOfBoundsException - 如果索引超出范围( 
            tabIndex <0 || 
            tabIndex > =选项卡数) 
           setDisplayedMnemonicIndexAt(int,int) , 
            setMnemonicAt(int,int) 
           public int getDisplayedMnemonicIndexAt(int tabIndex)
tabIndex - 助记符所指的标签的索引 
           IndexOutOfBoundsException - 如果索引超出范围( 
            tabIndex <0 || 
            tabIndex > =选项卡数) 
           setDisplayedMnemonicIndexAt(int,int) , 
            setMnemonicAt(int,int) 
           public Rectangle getBoundsAt(int index)
index 。 
           如果此索引中的选项卡当前在UI中不可见,则返回null 。 
           如果这个tabbedpane没有设置UI,那么返回null 。 
          index - 要查询的索引 
           Rectangle包含选项卡界限在 
            index或 
            null如果选项卡在 
            index当前不可见在UI中,或者如果没有设置此 
            tabbedpane上的UI 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           public void setTitleAt(int index,
                       String title) 
          index至title ,可以为null 。 
           如果指定了此选项卡的选项卡组件,则不显示标题。 
           如果该索引中没有选项卡,则会引发内部异常。 
          index - 应该设置标题的标签索引 
           title - 要在标签页中显示的标题 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           getTitleAt(int) , 
            setTabComponentAt(int, java.awt.Component) 
           public void setIconAt(int index,
                      Icon icon) 
          index至icon ,可以是null 。 
           这不设置禁用图标在icon 。 
           如果新的图标不同于当前图标和禁用的图标未明确设置,则LookAndFeel将被要求生成禁用的图标。 
           要明确设置禁用图标,请使用setDisableIconAt() 。 
           如果指定了此选项卡的选项卡组件,则不会显示该图标。 
           如果该索引中没有选项卡,则会引发内部异常。 
          index - 应该设置图标的标签索引 
           icon - 要在标签页中显示的图标 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           setDisabledIconAt(int, javax.swing.Icon) , 
            getIconAt(int) , 
            getDisabledIconAt(int) , 
            setTabComponentAt(int, java.awt.Component) 
           public void setDisabledIconAt(int index,
                              Icon disabledIcon) 
          index至icon ,可以是null 。 
           如果该索引中没有选项卡,则会引发内部异常。 
          index - 应该设置禁用图标的标签索引 
           disabledIcon - 禁用时要在标签页中显示的图标 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           getDisabledIconAt(int) 
           public void setToolTipTextAt(int index,
                             String toolTipText) 
          index至toolTipText ,可以是null 。 
           如果该索引中没有选项卡,则会引发内部异常。 
          index - 应该设置工具提示文本的选项卡索引 
           toolTipText - 要为选项卡显示的工具提示文本 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           getToolTipTextAt(int) 
           public void setBackgroundAt(int index,
                            Color background) 
          index到background可以是null ,在这种情况下选项卡的背景色默认为背景颜色tabbedpane 。 
           如果该索引中没有选项卡,则会引发内部异常。 
           这是符合这种财产的外观和感觉,有些人可能会选择忽略它。
index - 应该设置 
            index的标签索引 
           background - 要在标签背景中显示的颜色 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           getBackgroundAt(int) 
           public void setForegroundAt(int index,
                            Color foreground) 
          index至foreground ,可以为null ,在这种情况下,标签的前景色将默认为此tabbedpane 。 
           如果该索引中没有选项卡,则会引发内部异常。 
           这是符合这种财产的外观和感觉,有些人可能会选择忽略它。
index - 应设置 
            index的标签索引 
           foreground - 显示为标签前景的颜色 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           getForegroundAt(int) 
           public void setEnabledAt(int index,
                         boolean enabled) 
          index的选项卡。 
           如果该索引中没有选项卡,则会引发内部异常。 
          index - 应该启用/禁用的选项卡索引 
           enabled - 是否应启用该选项卡 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           isEnabledAt(int) 
           public void setComponentAt(int index,
                           Component component) 
          index至component 。 
           如果该索引中没有选项卡,则会引发内部异常。 
          index - 要放置此组件的选项卡索引 
           component - 选项卡的组件 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           getComponentAt(int) 
           public void setDisplayedMnemonicIndexAt(int tabIndex,
                                        int mnemonicIndex) 
           这个值被更新为与助记符变化相关的属性(如助记符本身,文本...)。 如果您不希望默认字符被加下划线,您应该只需要调用它。 例如,如果选项卡索引3处的文本是“苹果价格”,使用“p”的助记符,并且您希望将“P”装饰为“Apple P rice”,则在调用后必须调用setDisplayedMnemonicIndex(3, 6) setMnemonicAt(3, KeyEvent.VK_P) 。 
请注意,程序员有责任确保每个选项卡具有唯一的助记符或不可预测的结果。
tabIndex - 助记符所指的标签的索引 
           mnemonicIndex - 索引到 
            String下划线 
           IndexOutOfBoundsException - 如果 
            tabIndex超出范围( 
            tabIndex < 0 || tabIndex >= tab count ) 
           IllegalArgumentException - 如果 
            mnemonicIndex是> =选项卡标题的长度,或<-1 
           setMnemonicAt(int,int) , 
            getDisplayedMnemonicIndexAt(int) 
           public void setMnemonicAt(int tabIndex,
                          int mnemonic) 
           助记符必须对应于键盘上的单个键,并且应使用java.awt.event.KeyEvent中定义的VK_XXX键码java.awt.event.KeyEvent或通过java.awt.event.KeyEvent.getExtendedKeyCodeForChar获得的扩展键码之一来java.awt.event.KeyEvent.getExtendedKeyCodeForChar 。 助记符不区分大小写,因此具有相应键码的键事件将导致按钮被激活,无论Shift修改器是否被按下。 
这将更新指定选项卡的显示助记符属性。
tabIndex - 助记符所指的标签的索引 
           mnemonic - 表示助记符的关键代码 
           IndexOutOfBoundsException - 如果 
            tabIndex超出范围( 
            tabIndex < 0 || tabIndex >= tab count ) 
           getMnemonicAt(int) , 
            setDisplayedMnemonicIndexAt(int,int) 
           public int indexOfTab(String title)
title的第一个选项卡索引,如果没有选项卡具有此标题,则返回-1。 
          title - 标签的标题 
           title ,如果没有选项卡具有此标题,则为-1 
           public int indexOfTab(Icon icon)
icon的第一个选项卡索引,如果没有选项卡具有此图标,则返回-1。 
          icon - 标签的图标 
           icon ,如果没有选项卡具有此图标,则为-1 
           public int indexOfComponent(Component component)
component - 选项卡的组件 
           public int indexAtLocation(int x,
                           int y) 
          x - 相对于此标签页的x位置 
           y - 相对于此标签页的y位置 
           public String getToolTipText(MouseEvent event)
getToolTipText在 
            JComponent 
           event - 
            MouseEvent ,它告诉游标在哪里 
           String 
           protected String paramString()
JTabbedPane的字符串表示JTabbedPane 。 
           该方法仅用于调试目的,并且返回的字符串的内容和格式可能因实现而异。 
           返回的字符串可能为空,但可能不是null 。 
          paramString在 
            JComponent类 
           public AccessibleContext getAccessibleContext()
getAccessibleContext在界面 
            Accessible 
           getAccessibleContext在 
            Component 
           public void setTabComponentAt(int index,
                              Component component) 
          JTabbedPane将呈现指定选项卡的标题和/或图标。 
           非空值表示组件将呈现标题, JTabbedPane将不会呈现标题和/或图标。 
           注意:组件不能是开发人员已经添加到选项卡窗格的组件。
index - 应该设置组件的选项卡索引 
           component - 为指定选项卡呈现标题的组件 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           IllegalArgumentException - 如果组件已经添加到此 
            JTabbedPane 
           getTabComponentAt(int) 
           public Component getTabComponentAt(int index)
index 。 
          index - 被查询的项目的索引 
           index 
           IndexOutOfBoundsException - 如果索引超出范围 
            (index < 0 || index >= tab count) 
           setTabComponentAt(int, java.awt.Component) 
           public int indexOfTabComponent(Component tabComponent)
tabComponent - 选项卡的选项卡组件 
           setTabComponentAt(int, java.awt.Component) , 
            getTabComponentAt(int) 
            Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.