public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager, SwingConstants
| Modifier and Type | Class and Description |
|---|---|
protected class |
BasicScrollBarUI.ArrowButtonListener
光标键的侦听器。
|
protected class |
BasicScrollBarUI.ModelListener
一个听模型变化的听众。
|
class |
BasicScrollBarUI.PropertyChangeHandler |
protected class |
BasicScrollBarUI.ScrollListener
滚动的事件在
ScrollPane启动监听器。
|
protected class |
BasicScrollBarUI.TrackListener
跟踪鼠标拖动。
|
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 |
|---|
BasicScrollBarUI() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLayoutComponent(String name, Component child)
如果布局管理器使用的每一个组件串,添加成分
comp的布局,将其与指定的字符串
name。
|
protected void |
configureScrollBarColors() |
protected BasicScrollBarUI.ArrowButtonListener |
createArrowButtonListener() |
protected JButton |
createDecreaseButton(int orientation) |
protected JButton |
createIncreaseButton(int orientation) |
protected BasicScrollBarUI.ModelListener |
createModelListener() |
protected PropertyChangeListener |
createPropertyChangeListener() |
protected BasicScrollBarUI.ScrollListener |
createScrollListener() |
protected BasicScrollBarUI.TrackListener |
createTrackListener() |
static ComponentUI |
createUI(JComponent c) |
Dimension |
getMaximumSize(JComponent c)
返回指定组件的最大大小适合的外观和感觉。
|
protected Dimension |
getMaximumThumbSize()
返回最大可接受大小的拇指。
|
protected Dimension |
getMinimumThumbSize()
返回最小可接受大小的拇指。
|
Dimension |
getPreferredSize(JComponent c)
垂直滚动条的宽度是首选的首选宽度最大(非
null)增/减按钮,和拇指的最小宽度。
|
boolean |
getSupportsAbsolutePositioning()
指示用户是否绝对可以用鼠标手势(通常是鼠标中键)。
|
protected Rectangle |
getThumbBounds()
返回当前的大小/位置的拇指。
|
protected Rectangle |
getTrackBounds()
返回轨道的当前范围,即
|
protected void |
installComponents() |
protected void |
installDefaults() |
protected void |
installKeyboardActions() |
protected void |
installListeners() |
void |
installUI(JComponent c)
配置指定的组件适当的外观和感觉。
|
boolean |
isThumbRollover()
如果鼠标当前在拇指上,则返回真。
|
void |
layoutContainer(Container scrollbarContainer)
指定指定的容器。
|
protected void |
layoutHScrollbar(JScrollBar sb) |
protected void |
layoutVScrollbar(JScrollBar sb) |
Dimension |
minimumLayoutSize(Container scrollbarContainer)
计算指定容器的最小尺寸尺寸,给出它所包含的组件。
|
void |
paint(Graphics g, JComponent c)
适当地绘制指定的组件的外观和感觉。
|
protected void |
paintDecreaseHighlight(Graphics g) |
protected void |
paintIncreaseHighlight(Graphics g) |
protected void |
paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) |
protected void |
paintTrack(Graphics g, JComponent c, Rectangle trackBounds) |
Dimension |
preferredLayoutSize(Container scrollbarContainer)
计算指定容器的首选大小尺寸,给出它所包含的组件。
|
void |
removeLayoutComponent(Component child)
从布局中移除指定的组件。
|
protected void |
scrollByBlock(int direction) |
protected void |
scrollByUnit(int direction) |
protected void |
setThumbBounds(int x, int y, int width, int height)
套拇指的界限和力重,包括旧的和新的thumbbounds。
|
protected void |
setThumbRollover(boolean active)
设置是否鼠标当前在拇指上。
|
protected void |
uninstallComponents() |
protected void |
uninstallDefaults() |
protected void |
uninstallKeyboardActions() |
protected void |
uninstallListeners() |
void |
uninstallUI(JComponent c)
逆转形态,完成指定的组件在
installUI。
|
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMinimumSize, updateprotected Dimension minimumThumbSize
protected Dimension maximumThumbSize
protected Color thumbHighlightColor
protected Color thumbLightShadowColor
protected Color thumbDarkShadowColor
protected Color thumbColor
protected Color trackColor
protected Color trackHighlightColor
protected JScrollBar scrollbar
protected JButton incrButton
protected JButton decrButton
protected boolean isDragging
protected BasicScrollBarUI.TrackListener trackListener
protected BasicScrollBarUI.ArrowButtonListener buttonListener
protected BasicScrollBarUI.ModelListener modelListener
protected Rectangle thumbRect
protected Rectangle trackRect
protected int trackHighlight
protected static final int NO_HIGHLIGHT
protected static final int DECREASE_HIGHLIGHT
protected static final int INCREASE_HIGHLIGHT
protected BasicScrollBarUI.ScrollListener scrollListener
protected PropertyChangeListener propertyChangeListener
protected Timer scrollTimer
protected int scrollBarWidth
protected int incrGap
protected int decrGap
public static ComponentUI createUI(JComponent c)
protected void configureScrollBarColors()
public void installUI(JComponent c)
ComponentUI
ComponentUI实例被安装在指定组件的UI代理。这种方法应该完全配置的组件外观和感觉,包括以下内容:
LayoutManager组件上的必要。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。这个方法被调用时,这个
UIComponent实例被作为指定组件的UI代理删除。这种方法应该撤消配置进行
installUI,小心留下的
JComponent实例在干净的状态(没有多余的听众,外观和感觉的特定属性的对象,等)。这应包括以下几个方面:
uninstallUI 方法重写,继承类
ComponentUI
c -从这个UI代理被删除的组件;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
ComponentUI.installUI(javax.swing.JComponent),
JComponent.updateUI()
protected void installDefaults()
protected void installComponents()
protected void uninstallComponents()
protected void installListeners()
protected void installKeyboardActions()
protected void uninstallKeyboardActions()
protected void uninstallListeners()
protected void uninstallDefaults()
protected BasicScrollBarUI.TrackListener createTrackListener()
protected BasicScrollBarUI.ArrowButtonListener createArrowButtonListener()
protected BasicScrollBarUI.ModelListener createModelListener()
protected BasicScrollBarUI.ScrollListener createScrollListener()
protected PropertyChangeListener createPropertyChangeListener()
protected void setThumbRollover(boolean active)
active真表明拇指是目前活跃。
public boolean isThumbRollover()
public void paint(Graphics g, JComponent c)
ComponentUI
ComponentUI.update方法调用时指定的组件正在粉刷。子类应重写此方法,并使用指定的
Graphics对象呈现的成分含量。
paint 方法重写,继承类
ComponentUI
g -
Graphics背景的画
c -正在绘制的构件;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
public Dimension getPreferredSize(JComponent c)
null)增/减按钮,和拇指的最小宽度。优选的高度是同一部件的优选高度的总和。对于一个水平滚动条的首选大小基本相同。
的preferredSize只计算一次,随后调用此方法只返回一个缓存的大小。
getPreferredSize 方法重写,继承类
ComponentUI
c -
JScrollBar,授权该方法给我们
getMaximumSize(javax.swing.JComponent),
ComponentUI.getMinimumSize(javax.swing.JComponent)
public Dimension getMaximumSize(JComponent c)
ComponentUI
null返回,最大规模将由组件的布局管理器的计算(这是与一个特定的布局管理器安装任何组件的首选方法)。此方法的默认实现调用
getPreferredSize和返回值。
getMaximumSize 方法重写,继承类
ComponentUI
c -使用这种方法我们的授权。
ComponentUI.getMinimumSize(javax.swing.JComponent),
getPreferredSize(javax.swing.JComponent)
protected JButton createDecreaseButton(int orientation)
protected JButton createIncreaseButton(int orientation)
protected void paintDecreaseHighlight(Graphics g)
protected void paintIncreaseHighlight(Graphics g)
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds)
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
protected Dimension getMinimumThumbSize()
警告:此方法返回的值不能被修改,这是一个共享的静态常量。
getMaximumThumbSize()
protected Dimension getMaximumThumbSize()
getMinimumThumbSize返回相同的值。
警告:此方法返回的值不能被修改,这是一个共享的静态常量。
getMinimumThumbSize()
public void addLayoutComponent(String name, Component child)
LayoutManager
comp的布局,将其与指定的字符串
name。
addLayoutComponent 接口
LayoutManager
name要与组件关联的字符串
child -要添加的组件
public void removeLayoutComponent(Component child)
LayoutManager
removeLayoutComponent 接口
LayoutManager
child -要移除的组件
public Dimension preferredLayoutSize(Container scrollbarContainer)
LayoutManager
preferredLayoutSize 接口
LayoutManager
scrollbarContainer -容器被设置
LayoutManager.minimumLayoutSize(java.awt.Container)
public Dimension minimumLayoutSize(Container scrollbarContainer)
LayoutManager
minimumLayoutSize 接口
LayoutManager
scrollbarContainer -被设置的组件
LayoutManager.preferredLayoutSize(java.awt.Container)
protected void layoutVScrollbar(JScrollBar sb)
protected void layoutHScrollbar(JScrollBar sb)
public void layoutContainer(Container scrollbarContainer)
LayoutManager
layoutContainer 接口
LayoutManager
scrollbarContainer -容器被设置
protected void setThumbBounds(int x,
int y,
int width,
int height)
getThumbBounds()
protected Rectangle getThumbBounds()
警告:此方法返回的值不能被修改,它的实际的参考矩形,而不是复制。
setThumbBounds(int, int, int, int)
protected Rectangle getTrackBounds()
警告:此方法返回的值不能被修改,它的实际的参考矩形,而不是复制。
layoutContainer(java.awt.Container)
protected void scrollByBlock(int direction)
protected void scrollByUnit(int direction)
public boolean getSupportsAbsolutePositioning()
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.