public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
Modifier and Type | Class and Description |
---|---|
class |
BasicTabbedPaneUI.FocusHandler
这个类应该被视为一个“受保护”的内部类。
|
class |
BasicTabbedPaneUI.MouseHandler
这个类应该被视为一个“受保护”的内部类。
|
class |
BasicTabbedPaneUI.PropertyChangeHandler
这个类应该被视为一个“受保护”的内部类。
|
class |
BasicTabbedPaneUI.TabbedPaneLayout
这个类应该被视为一个“受保护”的内部类。
|
class |
BasicTabbedPaneUI.TabSelectionHandler
这个类应该被视为一个“受保护”的内部类。
|
Modifier and Type | Field and Description |
---|---|
protected Rectangle |
calcRect
用于一般布局计算的矩形,以避免构建许多新的矩形。
|
protected Insets |
contentBorderInsets |
protected Color |
darkShadow |
protected KeyStroke |
downKey
已弃用
从Java 2平台v1.3开始。
|
protected Color |
focus |
protected FocusListener |
focusListener |
protected Color |
highlight |
protected KeyStroke |
leftKey
已弃用
从Java 2平台v1.3开始。
|
protected Color |
lightHighlight |
protected int |
maxTabHeight |
protected int |
maxTabWidth |
protected MouseListener |
mouseListener |
protected PropertyChangeListener |
propertyChangeListener |
protected Rectangle[] |
rects |
protected KeyStroke |
rightKey
已弃用
从Java 2平台v1.3开始。
|
protected int |
runCount |
protected int |
selectedRun |
protected Insets |
selectedTabPadInsets |
protected Color |
shadow |
protected Insets |
tabAreaInsets |
protected ChangeListener |
tabChangeListener |
protected Insets |
tabInsets |
protected JTabbedPane |
tabPane |
protected int |
tabRunOverlay |
protected int[] |
tabRuns |
protected int |
textIconGap |
protected KeyStroke |
upKey
已弃用
从Java 2平台v1.3开始。
|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor and Description |
---|
BasicTabbedPaneUI() |
Modifier and Type | Method and Description |
---|---|
protected void |
assureRectsCreated(int tabCount) |
protected int |
calculateMaxTabHeight(int tabPlacement) |
protected int |
calculateMaxTabWidth(int tabPlacement) |
protected int |
calculateTabAreaHeight(int tabPlacement, int horizRunCount, int maxTabHeight) |
protected int |
calculateTabAreaWidth(int tabPlacement, int vertRunCount, int maxTabWidth) |
protected int |
calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) |
protected int |
calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) |
protected ChangeListener |
createChangeListener() |
protected FocusListener |
createFocusListener() |
protected LayoutManager |
createLayoutManager()
调用
installUI 创建一个布局管理器对象来管理
JTabbedPane 。
|
protected MouseListener |
createMouseListener() |
protected PropertyChangeListener |
createPropertyChangeListener() |
protected JButton |
createScrollButton(int direction)
创建并返回一个JButton,它将向用户提供一种在特定方向滚动选项卡的方法。
|
static ComponentUI |
createUI(JComponent c) |
protected void |
expandTabRunsArray() |
protected int |
getBaseline(int tab)
返回指定选项卡的基线。
|
int |
getBaseline(JComponent c, int width, int height)
返回基线。
|
protected int |
getBaselineOffset()
返回基线偏移量。
|
Component.BaselineResizeBehavior |
getBaselineResizeBehavior(JComponent c)
返回一个枚举,指示组件的基线如何随着大小的变化而改变。
|
protected Insets |
getContentBorderInsets(int tabPlacement) |
protected int |
getFocusIndex()
返回具有焦点的选项卡的索引。
|
protected FontMetrics |
getFontMetrics() |
protected Icon |
getIconForTab(int tabIndex) |
Dimension |
getMaximumSize(JComponent c)
返回指定组件的最大尺寸,适合外观和感觉。
|
Dimension |
getMinimumSize(JComponent c)
返回指定组件的最小尺寸,适合外观和感觉。
|
protected int |
getNextTabIndex(int base) |
protected int |
getNextTabIndexInRun(int tabCount, int base) |
protected int |
getNextTabRun(int baseRun) |
protected int |
getPreviousTabIndex(int base) |
protected int |
getPreviousTabIndexInRun(int tabCount, int base) |
protected int |
getPreviousTabRun(int baseRun) |
protected int |
getRolloverTab()
返回标签的鼠标是目前超过,或
-1 如果鼠标在任何标签不再。
|
protected int |
getRunForTab(int tabCount, int tabIndex) |
protected Insets |
getSelectedTabPadInsets(int tabPlacement) |
protected Insets |
getTabAreaInsets(int tabPlacement) |
protected Rectangle |
getTabBounds(int tabIndex, Rectangle dest)
返回JTabbedPane组件坐标空间中指定选项卡的边界。
|
Rectangle |
getTabBounds(JTabbedPane pane, int i)
返回指定选项卡索引的边界。
|
protected Insets |
getTabInsets(int tabPlacement, int tabIndex) |
protected int |
getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) |
protected int |
getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) |
int |
getTabRunCount(JTabbedPane pane) |
protected int |
getTabRunIndent(int tabPlacement, int run) |
protected int |
getTabRunOffset(int tabPlacement, int tabCount, int tabIndex, boolean forward) |
protected int |
getTabRunOverlay(int tabPlacement) |
protected View |
getTextViewForTab(int tabIndex)
返回为指定选项卡呈现风格化文本(HTML)所需的文本View对象,如果此选项卡不需要专门的文本呈现,则返回null。
|
protected Component |
getVisibleComponent() |
protected void |
installComponents()
为JTabbedPane创建并安装任何所需的子组件。
|
protected void |
installDefaults() |
protected void |
installKeyboardActions() |
protected void |
installListeners() |
void |
installUI(JComponent c)
适当地配置指定的组件的外观和感觉。
|
protected int |
lastTabInRun(int tabCount, int run) |
protected void |
layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected) |
protected void |
navigateSelectedTab(int direction) |
void |
paint(Graphics g, JComponent c)
适当地涂抹指定的组件的外观和感觉。
|
protected void |
paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) |
protected void |
paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) |
protected void |
paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) |
protected void |
paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) |
protected void |
paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) |
protected void |
paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) |
protected void |
paintIcon(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected) |
protected void |
paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect) |
protected void |
paintTabArea(Graphics g, int tabPlacement, int selectedIndex)
绘制标签区域中的选项卡。
|
protected void |
paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) |
protected void |
paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
此函数绘制每个选项卡周围的边框,该函数现在绘制该选项卡的背景。
|
protected void |
paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected) |
protected static void |
rotateInsets(Insets topInsets, Insets targetInsets, int targetPlacement) |
protected void |
selectAdjacentRunTab(int tabPlacement, int tabIndex, int offset) |
protected void |
selectNextTab(int current) |
protected void |
selectNextTabInRun(int current) |
protected void |
selectPreviousTab(int current) |
protected void |
selectPreviousTabInRun(int current) |
protected void |
setRolloverTab(int index)
将鼠标目前的标签设置为
index 。
|
protected void |
setVisibleComponent(Component component) |
protected boolean |
shouldPadTabRun(int tabPlacement, int run) |
protected boolean |
shouldRotateTabRuns(int tabPlacement) |
int |
tabForCoordinate(JTabbedPane pane, int x, int y)
返回与JTabbedPane坐标空间中指定点相交的选项卡索引。
|
protected void |
uninstallComponents()
从JTabbedPane中删除任何已安装的子组件。
|
protected void |
uninstallDefaults() |
protected void |
uninstallKeyboardActions() |
protected void |
uninstallListeners() |
void |
uninstallUI(JComponent c)
在installUI中反转在
installUI 上完成的
installUI 。
|
contains, getAccessibleChild, getAccessibleChildrenCount, getPreferredSize, update
protected JTabbedPane tabPane
protected Color highlight
protected Color lightHighlight
protected Color shadow
protected Color darkShadow
protected Color focus
protected int textIconGap
protected int tabRunOverlay
protected Insets tabInsets
protected Insets selectedTabPadInsets
protected Insets tabAreaInsets
protected Insets contentBorderInsets
@Deprecated protected KeyStroke upKey
@Deprecated protected KeyStroke downKey
@Deprecated protected KeyStroke leftKey
@Deprecated protected KeyStroke rightKey
protected int[] tabRuns
protected int runCount
protected int selectedRun
protected Rectangle[] rects
protected int maxTabHeight
protected int maxTabWidth
protected ChangeListener tabChangeListener
protected PropertyChangeListener propertyChangeListener
protected MouseListener mouseListener
protected FocusListener focusListener
protected transient Rectangle calcRect
public static ComponentUI createUI(JComponent c)
public void installUI(JComponent c)
ComponentUI
ComponentUI
实例作为指定组件上的UI委托时,将调用此方法。
该方法应该完全配置组件的外观,包括以下内容:
LayoutManager
上安装LayoutManager。 PropertyChangeListener
上创建/安装PropertyChangeListener,以便适当地检测和响应组件属性的更改。 installUI
在
ComponentUI
c
- 正在安装此UI代理的组件
ComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
public void uninstallUI(JComponent c)
ComponentUI
installUI
上完成的installUI
。
当这个UIComponent
实例作为指定组件的UI委托被删除时,将调用此方法。
该方法应该撤消在installUI中执行的installUI
,小心使JComponent
实例处于干净状态(无外部侦听器,外观特定属性对象等)。
这应该包括以下内容:
uninstallUI
在
ComponentUI
c
- 从中删除此UI代理的组件;
这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用
ComponentUI.installUI(javax.swing.JComponent)
,
JComponent.updateUI()
protected LayoutManager createLayoutManager()
installUI
创建一个布局管理器对象来管理
JTabbedPane
。
BasicTabbedPaneUI.TabbedPaneLayout
, JTabbedPane.getTabLayoutPolicy()
protected void installComponents()
protected JButton createScrollButton(int direction)
direction
- 其中一个SwingConstants常量:SOUTH,NORTH,EAST或WEST
IllegalArgumentException
- 如果方向不是NORTH,SOUTH,EAST或WEST之一
JTabbedPane.setTabPlacement(int)
, SwingConstants
protected void uninstallComponents()
protected void installDefaults()
protected void uninstallDefaults()
protected void installListeners()
protected void uninstallListeners()
protected MouseListener createMouseListener()
protected FocusListener createFocusListener()
protected ChangeListener createChangeListener()
protected PropertyChangeListener createPropertyChangeListener()
protected void installKeyboardActions()
protected void uninstallKeyboardActions()
protected void setRolloverTab(int index)
index
。
如果鼠标不再在任何标签上, index
将为-1。
不进行任何检查,以确保传入的索引中标识有效的选项卡。
index
- 鼠标结束的标签索引。
protected int getRolloverTab()
-1
如果鼠标在任何标签不再。
-1
public Dimension getMinimumSize(JComponent c)
ComponentUI
null
,则最小尺寸将由组件的布局管理器计算(这是安装了特定布局管理器的任何组件的首选方法)。
此方法的默认实现将调用getPreferredSize
并返回该值。
getMinimumSize
在
ComponentUI
c
- 查询最小大小的组件;
这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用
Dimension
对象或
null
JComponent.getMinimumSize()
,
LayoutManager.minimumLayoutSize(java.awt.Container)
,
ComponentUI.getPreferredSize(javax.swing.JComponent)
public Dimension getMaximumSize(JComponent c)
ComponentUI
null
,则最大大小将由组件的布局管理器计算(这是安装了特定布局管理器的任何组件的首选方法)。
此方法的默认实现将调用getPreferredSize
并返回该值。
getMaximumSize
在
ComponentUI
c
- 查询最大大小的组件;
这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用
Dimension
对象或
null
JComponent.getMaximumSize()
,
LayoutManager2.maximumLayoutSize(java.awt.Container)
public int getBaseline(JComponent c, int width, int height)
getBaseline
在
ComponentUI
c
-
JComponent
正在请求基准
width
- 获取基准的宽度
height
- 获取基准的高度
NullPointerException
- 如果
c
是
null
IllegalArgumentException
- 如果宽度或高度<0
JComponent.getBaseline(int, int)
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
getBaselineResizeBehavior
在
ComponentUI
c
-
JComponent
以返回基线调整大小行为
NullPointerException
- 如果
c
是
null
JComponent.getBaseline(int, int)
protected int getBaseline(int tab)
tab
- 获取基准的标签索引
IndexOutOfBoundsException
- 如果索引超出范围(index <0 || index> = tab count)
protected int getBaselineOffset()
getTabLabelShiftY
。
public void paint(Graphics g, JComponent c)
ComponentUI
ComponentUI.update
指定组件正在被绘制时的方法。
子类应该覆盖此方法,并使用指定的Graphics
对象来呈现Graphics
的内容。
paint
在
ComponentUI
类
g
- 要绘画的
Graphics
上下文
c
- 正在画的部件
这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
protected void paintTabArea(Graphics g, int tabPlacement, int selectedIndex)
Graphics
对象。
标签位置可以是: JTabbedPane.TOP
, JTabbedPane.BOTTOM
, JTabbedPane.LEFT
,或JTabbedPane.RIGHT
。
所选索引必须是有效的选项卡窗格选项卡索引(0至选项卡计数-1(含)),如果当前未选择任何选项卡,则为-1。
未指定无效参数的处理。
g
- 用于呈现的图形对象
tabPlacement
- JTabbedPane中选项卡的位置
selectedIndex
- 所选组件的选项卡索引
protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect)
protected void layoutLabel(int tabPlacement, FontMetrics metrics, int tabIndex, String title, Icon icon, Rectangle tabRect, Rectangle iconRect, Rectangle textRect, boolean isSelected)
protected void paintIcon(Graphics g, int tabPlacement, int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected)
protected void paintText(Graphics g, int tabPlacement, Font font, FontMetrics metrics, int tabIndex, String title, Rectangle textRect, boolean isSelected)
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected)
protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected)
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
protected void paintTabBackground(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected)
protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex)
protected void paintContentBorderTopEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void paintContentBorderLeftEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void paintContentBorderBottomEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
protected void paintContentBorderRightEdge(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h)
public Rectangle getTabBounds(JTabbedPane pane, int i)
getTabBounds
在
TabbedPaneUI
public int getTabRunCount(JTabbedPane pane)
getTabRunCount
在
TabbedPaneUI
public int tabForCoordinate(JTabbedPane pane, int x, int y)
tabForCoordinate
在
TabbedPaneUI
类
protected Rectangle getTabBounds(int tabIndex, Rectangle dest)
Rectangle
实例。
未指定无效参数的处理。
tabIndex
- 选项卡的索引
dest
- 应该放置结果的矩形
protected Component getVisibleComponent()
protected void setVisibleComponent(Component component)
protected void assureRectsCreated(int tabCount)
protected void expandTabRunsArray()
protected int getRunForTab(int tabCount, int tabIndex)
protected int lastTabInRun(int tabCount, int run)
protected int getTabRunOverlay(int tabPlacement)
protected int getTabRunIndent(int tabPlacement, int run)
protected boolean shouldPadTabRun(int tabPlacement, int run)
protected boolean shouldRotateTabRuns(int tabPlacement)
protected Icon getIconForTab(int tabIndex)
protected View getTextViewForTab(int tabIndex)
tabIndex
- 选项卡的索引
protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight)
protected int calculateMaxTabHeight(int tabPlacement)
protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
protected int calculateMaxTabWidth(int tabPlacement)
protected int calculateTabAreaHeight(int tabPlacement, int horizRunCount, int maxTabHeight)
protected int calculateTabAreaWidth(int tabPlacement, int vertRunCount, int maxTabWidth)
protected Insets getTabInsets(int tabPlacement, int tabIndex)
protected Insets getSelectedTabPadInsets(int tabPlacement)
protected Insets getTabAreaInsets(int tabPlacement)
protected Insets getContentBorderInsets(int tabPlacement)
protected FontMetrics getFontMetrics()
protected void navigateSelectedTab(int direction)
protected void selectNextTabInRun(int current)
protected void selectPreviousTabInRun(int current)
protected void selectNextTab(int current)
protected void selectPreviousTab(int current)
protected void selectAdjacentRunTab(int tabPlacement, int tabIndex, int offset)
protected int getFocusIndex()
protected int getTabRunOffset(int tabPlacement, int tabCount, int tabIndex, boolean forward)
protected int getPreviousTabIndex(int base)
protected int getNextTabIndex(int base)
protected int getNextTabIndexInRun(int tabCount, int base)
protected int getPreviousTabIndexInRun(int tabCount, int base)
protected int getPreviousTabRun(int baseRun)
protected int getNextTabRun(int baseRun)