public class JTabbedPane extends JComponent implements Serializable, Accessible, SwingConstants
标签/部件采用addTab和insertTab方法添加到一个TabbedPane对象。一个标签是由一个索引对应的位置,它被添加在,其中第一个标签有一个指数等于0,最后一个标签有一个指数等于标签数减去1。
的TabbedPane使用SingleSelectionModel代表标签指标集和当前选择的索引。如果制表符数大于0,则将始终是一个选定的索引,默认情况下将被初始化为第一个标签。如果制表符计数为0,则所选择的索引将为- 1。
选项卡标题可以由Component渲染。例如,下面的产生类似的结果:
在这种情况下,外观和感觉呈现标签的标题。使用。addtab(“标签”,mycomponent);在这种情况下,自定义组件负责渲染标签的标题。使用addtab(null,mycomponent);使用。settabcomponentat(0,新方法(“Tab”));后者通常用在当你想要一个更复杂的用户交互,需要自定义组件上的标签。例如,你可以提供一个自定义组件,动画或已关闭的选项卡控件。
如果你指定一个标签组件的JTabbedPane不会呈现任何文字或图标,你对”选项卡中指定。
注:不使用setVisible直接在标签成分使其可见,使用setSelectedComponent或setSelectedIndex方法代替。
警告: Swing是线程不安全的。更多信息见Swing's Threading Policy。
警告:序列化该类的对象与以后的Swing版本不兼容。当前的序列化支持适用于短期贮藏或RMI运行相同Swing版本的应用程序之间。为1.4,为所有JavaBeans™长期存储的支持已被添加到java.beans包。请看XMLEncoder。
SingleSelectionModel
| Modifier and Type | Class and Description |
|---|---|
protected class |
JTabbedPane.AccessibleJTabbedPane
这个类实现了对
JTabbedPane类可访问性支持。
|
protected class |
JTabbedPane.ModelListener
我们通过
ModelChanged事件与使用听众(而不是模型本身)作为事件源。
|
JComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
protected ChangeEvent |
changeEvent
只有一个
ChangeEvent是需要每个
TabPane实例事件以来唯一的(只读)国家财产的来源。
|
protected ChangeListener |
changeListener
这是我们
changeListener侦听器添加到模型。
|
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.getName结果的组件的名称
component。
|
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这个使用。
|
void |
addTab(String title, Component component)
增加了一个
component由
title没有图标表示。
|
void |
addTab(String title, Icon icon, Component component)
增加了一个
component由
title和/或
icon表示,也可
null。
|
void |
addTab(String title, Icon icon, Component component, String tip)
增加了一个
component和
tip由
title和/或
icon表示,也可
null。
|
protected ChangeListener |
createChangeListener()
要处理不同的子类可以重写此
ChangeEvents返回
ModelListener或另一个
ChangeListener实现子类。
|
protected void |
fireStateChanged()
发送一个
ChangeEvent,这
JTabbedPane为源,每个注册的监听器。
|
AccessibleContext |
getAccessibleContext()
获取与此相关的accessiblecontext通过。
|
Color |
getBackgroundAt(int index)
返回
index标签的背景颜色。
|
Rectangle |
getBoundsAt(int index)
返回标签的界限在
index。
|
ChangeListener[] |
getChangeListeners()
返回所有的
ChangeListeners数组添加到这个
JTabbedPane与
addChangeListener。
|
Component |
getComponentAt(int 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 Tab组件。
|
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”的用户界面对象。
|
String |
getUIClassID()
返回实现此组件的“为”的“用户界面”类的名称。
|
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字符串表示形式。
|
void |
remove(Component component)
从
JTabbedPane移除指定的
Component。
|
void |
remove(int index)
移除对应于指定索引的制表符和组件。
|
void |
removeAll()
删除所有的标签和相应的组件从
tabbedpane。
|
void |
removeChangeListener(ChangeListener l)
除去这一
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”的用户界面对象。
|
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
ChangeEvent是需要每个
TabPane实例事件以来唯一的(只读)国家财产的来源。这里产生的事件的来源永远是“这”。
public JTabbedPane()
JTabbedPane.TOP默认标签位置空
TabbedPane。
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这个使用。
l -
ChangeListener添加
fireStateChanged(),
removeChangeListener(javax.swing.event.ChangeListener)
public void removeChangeListener(ChangeListener l)
ChangeListener使用。
l -
ChangeListener删除
fireStateChanged(),
addChangeListener(javax.swing.event.ChangeListener)
public ChangeListener[] getChangeListeners()
ChangeListeners数组添加到这个
JTabbedPane与
addChangeListener。
ChangeListeners说如果没有听众已添加一个空数组
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.TOPJTabbedPane.BOTTOMJTabbedPane.LEFTJTabbedPane.RIGHTSwingConstants.TOP。
tabPlacement -放置标签相关的内容
IllegalArgumentException如果标签放置的价值不是一个以上的有效值
public int getTabLayoutPolicy()
setTabLayoutPolicy(int)
public void setTabLayoutPolicy(int tabLayoutPolicy)
JTabbedPane.WRAP_TAB_LAYOUTJTabbedPane.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由
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由
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.getName结果的组件的名称
component
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 -标签被删除索引
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)
JTabbedPane移除指定的
Component。如果
component为空的方法不。
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删除索引
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。
public int getTabCount()
tabbedpane返回标签的数量。
public int getTabRunCount()
tabPlacement是
TOP或
BOTTOM和列数如果
tabPlacement是
LEFT或
RIGHT,或0如果没有UI设置该
tabbedpane
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 -的项的索引查询
index选项卡的背景
Color
IndexOutOfBoundsException如果索引超出范围
(index < 0 || index >= tab count)
setBackgroundAt(int, java.awt.Color)
public Color getForegroundAt(int index)
index标签前景颜色。
index -的项的索引查询
index TAB的前景
Color
IndexOutOfBoundsException如果索引超出范围
(index < 0 || index >= tab count)
setForegroundAt(int, java.awt.Color)
public boolean isEnabledAt(int index)
index标签已启用。
index -的项的索引查询
index选项卡启用真;否则为false
IndexOutOfBoundsException如果索引超出范围
(index < 0 || index >= tab count)
setEnabledAt(int, boolean)
public Component getComponentAt(int index)
index组件。
index -的项的索引查询
index的
Component
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。如果没有UI设置该
tabbedpane,然后返回
null。
index -要查询的索引
Rectangle含有标签的范围
index,或
null如果UI标签
index不可见,或者如果没有UI设置该
tabbedpane
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残疾人图标。如果新的图标是不同的比当前图标和残疾人的图标是不明确的,它要产生一个残疾人图标。明确地把残疾人的图标,使用
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的选项卡索引所在的背景应设置
background -颜色是在标签的背景显示
IndexOutOfBoundsException如果索引超出范围
(index < 0 || index >= tab count)
getBackgroundAt(int)
public void setForegroundAt(int index,
Color foreground)
index到
foreground可
null前景颜色,在这种情况下,标签的前景色默认为本
tabbedpane前景颜色。如果该索引中没有选项卡,则引发内部异常。
这是向上的外观和感觉尊重这个属性,有些人可能会选择忽略它。
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”加以装饰,为“苹果Price ',你必须调用后调用setMnemonicAt(3, KeyEvent.VK_P) setDisplayedMnemonicIndex(3, 6)。
请注意,这是程序员的责任确保每个标签都有一个独特的记忆或可能发生不可预知的结果。
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)
一种记忆必须对应键盘上的一个关键,应该使用一个按键的VK_XXX定义java.awt.event.KeyEvent或通过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字符串表示形式。此方法仅用于调试目的,返回的字符串的内容和格式可能会在实现过程中有所不同。返回的字符串是空的但可能不
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 Tab组件。
index -的项的索引查询
index Tab组件
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.