- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ScrollBarUI
-
- javax.swing.plaf.basic.BasicScrollBarUI
-
- javax.swing.plaf.synth.SynthScrollBarUI
-
- All Implemented Interfaces:
-
LayoutManager,PropertyChangeListener,EventListener,SynthConstants,SynthUI,SwingConstants
public class SynthScrollBarUI extends BasicScrollBarUI implements PropertyChangeListener, SynthUI
为JScrollBar提供Synth L&F UI代表。- 从以下版本开始:
- 1.7
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicScrollBarUI
BasicScrollBarUI.ArrowButtonListener, BasicScrollBarUI.ModelListener, BasicScrollBarUI.PropertyChangeHandler, BasicScrollBarUI.ScrollListener, BasicScrollBarUI.TrackListener
-
-
Field Summary
-
Fields inherited from class javax.swing.plaf.basic.BasicScrollBarUI
buttonListener, decrButton, DECREASE_HIGHLIGHT, decrGap, incrButton, INCREASE_HIGHLIGHT, incrGap, isDragging, maximumThumbSize, minimumThumbSize, modelListener, NO_HIGHLIGHT, propertyChangeListener, scrollbar, scrollBarWidth, scrollListener, scrollTimer, thumbColor, thumbDarkShadowColor, thumbHighlightColor, thumbLightShadowColor, thumbRect, trackColor, trackHighlight, trackHighlightColor, trackListener, trackRect
-
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
-
Fields inherited from interface javax.swing.plaf.synth.SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
-
-
构造方法摘要
构造方法 Constructor 描述 SynthScrollBarUI()
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 protected voidconfigureScrollBarColors()配置滚动条颜色。protected JButtoncreateDecreaseButton(int orientation)创建减少按钮。protected JButtoncreateIncreaseButton(int orientation)创建一个增加按钮。static ComponentUIcreateUI(JComponent c)返回一个UI。SynthContextgetContext(JComponent c)返回指定组件的上下文。protected DimensiongetMinimumThumbSize()返回拇指的最小可接受尺寸。DimensiongetPreferredSize(JComponent c)垂直滚动条的首选宽度是(非null)增量/减量按钮的最大宽度以及拇指的最小宽度。booleangetSupportsAbsolutePositioning()指示用户是否可以用鼠标手势(通常是鼠标中键)绝对定位拇指。protected voidinstallDefaults()安装默认值。protected voidinstallListeners()安装侦听器voidpaint(Graphics g, JComponent c)根据外观和外观绘制指定的组件。protected voidpaint(SynthContext context, Graphics g)绘制指定的组件。voidpaintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)画边框protected voidpaintThumb(SynthContext context, Graphics g, Rectangle thumbBounds)绘制滚动条拇指。protected voidpaintTrack(SynthContext context, Graphics g, Rectangle trackBounds)绘制滚动条轨道。voidpropertyChange(PropertyChangeEvent e)当绑定属性更改时,此方法将被调用。protected voidsetThumbRollover(boolean active)设置鼠标是否当前在拇指上。protected voiduninstallDefaults()卸载默认值。protected voiduninstallListeners()卸载侦听器。voidupdate(Graphics g, JComponent c)通知此UI代理重新绘制指定的组件。-
Methods inherited from class javax.swing.plaf.basic.BasicScrollBarUI
addLayoutComponent, createArrowButtonListener, createModelListener, createPropertyChangeListener, createScrollListener, createTrackListener, getMaximumSize, getMaximumThumbSize, getThumbBounds, getTrackBounds, installComponents, installKeyboardActions, installUI, isThumbRollover, layoutContainer, layoutHScrollbar, layoutVScrollbar, minimumLayoutSize, paintDecreaseHighlight, paintIncreaseHighlight, paintThumb, paintTrack, preferredLayoutSize, removeLayoutComponent, scrollByBlock, scrollByUnit, setThumbBounds, uninstallComponents, uninstallKeyboardActions, uninstallUI
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMinimumSize
-
-
-
-
方法详细信息
-
createUI
public static ComponentUI createUI(JComponent c)
返回一个UI。- 参数
-
c- 一个组件 - 结果
- 一个UI
-
installDefaults
protected void installDefaults()
安装默认值。
-
configureScrollBarColors
protected void configureScrollBarColors()
配置滚动条颜色。
-
installListeners
protected void installListeners()
安装侦听器
-
uninstallListeners
protected void uninstallListeners()
卸载侦听器。
-
uninstallDefaults
protected void uninstallDefaults()
卸载默认值。
-
getContext
public SynthContext getContext(JComponent c)
返回指定组件的上下文。- Specified by:
-
getContext在接口SynthUI - 参数
-
c- 组件请求SynthContext。 - 结果
- SynthContext描述组件。
-
getSupportsAbsolutePositioning
public boolean getSupportsAbsolutePositioning()
指示用户是否可以用鼠标手势(通常是鼠标中键)绝对定位拇指。- 重写:
-
getSupportsAbsolutePositioning在BasicScrollBarUI - 结果
- 如果鼠标手势可以绝对定位拇指,则为true
-
update
public void update(Graphics g, JComponent c)
通知此UI代理重新绘制指定的组件。 该方法描述了组件背景,然后调用了paint(SynthContext,Graphics)方法。通常,此方法不需要被子类覆盖。 所有Look和Feel渲染代码应该在
paint方法中。- 重写:
-
update在ComponentUI - 参数
-
g- 用于绘画的Graphics对象 -
c- 正在涂漆的组件 - 另请参见:
-
paint(SynthContext,Graphics)
-
paint
public void paint(Graphics g, JComponent c)
根据外观和外观绘制指定的组件。Synth Look and Feel不使用此方法。 绘画由
paint(SynthContext,Graphics)处理。- 重写:
-
paint在BasicScrollBarUI - 参数
-
g- 用于绘画的Graphics对象 -
c- 正在涂漆的组件 - 另请参见:
-
paint(SynthContext,Graphics)
-
paint
protected void paint(SynthContext context, Graphics g)
绘制指定的组件。- 参数
-
context- 正在绘制的组件的上下文 -
g- 用于绘画的Graphics对象 - 另请参见:
-
update(Graphics,JComponent)
-
paintBorder
public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)
画边框- Specified by:
-
paintBorder在接口SynthUI - 参数
-
context- 组件上下文 -
g-Graphics上画 -
x- X坐标 -
y- Y坐标 -
w- 边框的宽度 -
h- 边框的高度
-
paintTrack
protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds)
绘制滚动条轨道。- 参数
-
context- 正在绘制的组件的上下文 -
g-Graphics用于绘画的对象 -
trackBounds- 轨道的边界框
-
paintThumb
protected void paintThumb(SynthContext context, Graphics g, Rectangle thumbBounds)
绘制滚动条拇指。- 参数
-
context- 正在绘制的组件的上下文 -
g-Graphics用于绘画的对象 -
thumbBounds- 拇指的边框
-
getPreferredSize
public Dimension getPreferredSize(JComponent c)
垂直滚动条的首选宽度是(非null)增量/减量按钮的最大宽度以及拇指的最小宽度。 优选的高度是相同部件的优选高度的总和。 水平滚动条的首选尺寸的基础是相似的。preferredSize只计算一次,对此方法的后续调用只返回缓存的大小。- 重写:
-
getPreferredSize在BasicScrollBarUI - 参数
-
c- 将这个方法委托给我们的JScrollBar - 结果
- 基本JScrollBar的首选大小
- 另请参见:
-
BasicScrollBarUI.getMaximumSize(javax.swing.JComponent),ComponentUI.getMinimumSize(javax.swing.JComponent)
-
getMinimumThumbSize
protected Dimension getMinimumThumbSize()
返回拇指的最小可接受尺寸。 如果滚动条变得如此之小,以至于此大小不可用,拇指将被隐藏。警告 :此方法返回的值不应该被修改,它是一个共享静态常量。
- 重写:
-
getMinimumThumbSize在BasicScrollBarUI - 结果
- 拇指的最小可接受尺寸。
- 另请参见:
-
BasicScrollBarUI.getMaximumThumbSize()
-
createDecreaseButton
protected JButton createDecreaseButton(int orientation)
创建减少按钮。- 重写:
-
createDecreaseButton在BasicScrollBarUI - 参数
-
orientation- 方向 - 结果
- 减少按钮
-
createIncreaseButton
protected JButton createIncreaseButton(int orientation)
创建一个增加按钮。- 重写:
-
createIncreaseButton在BasicScrollBarUI - 参数
-
orientation- 方向 - 结果
- 增加按钮
-
setThumbRollover
protected void setThumbRollover(boolean active)
设置鼠标是否当前在拇指上。- 重写:
-
setThumbRollover在BasicScrollBarUI - 参数
-
active- True表示缩略图当前处于活动状态。
-
propertyChange
public void propertyChange(PropertyChangeEvent e)
描述从接口PropertyChangeListener复制当绑定属性更改时,此方法将被调用。- Specified by:
-
propertyChange在接口PropertyChangeListener - 参数
-
e- A PropertyChangeEvent object describing the event source and the property that has changed.
-
-