- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.SliderUI
-
- javax.swing.plaf.basic.BasicSliderUI
-
- javax.swing.plaf.synth.SynthSliderUI
-
- All Implemented Interfaces:
-
PropertyChangeListener,EventListener,SynthConstants,SynthUI
public class SynthSliderUI extends BasicSliderUI implements PropertyChangeListener, SynthUI
为JSlider提供Synth L&F UI代表。- 从以下版本开始:
- 1.7
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicSliderUI
BasicSliderUI.ActionScroller, BasicSliderUI.ChangeHandler, BasicSliderUI.ComponentHandler, BasicSliderUI.FocusHandler, BasicSliderUI.PropertyChangeHandler, BasicSliderUI.ScrollListener, BasicSliderUI.TrackListener
-
-
Field Summary
-
Fields inherited from class javax.swing.plaf.basic.BasicSliderUI
changeListener, componentListener, contentRect, focusInsets, focusListener, focusRect, insetCache, labelRect, leftToRightCache, MAX_SCROLL, MIN_SCROLL, NEGATIVE_SCROLL, POSITIVE_SCROLL, propertyChangeListener, scrollListener, scrollTimer, slider, thumbRect, tickRect, trackBuffer, trackListener, trackRect
-
Fields inherited from interface javax.swing.plaf.synth.SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
-
-
构造方法摘要
构造方法 Modifier Constructor 描述 protectedSynthSliderUI(JSlider c)构造一个SynthSliderUI。
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 protected voidcalculateGeometry()计算几何。protected voidcalculateThumbLocation()计算拇指位置。protected BasicSliderUI.TrackListenercreateTrackListener(JSlider s)创建一个轨道监听器。static ComponentUIcreateUI(JComponent c)为给定的组件创建一个新的UI对象。intgetBaseline(JComponent c, int width, int height)返回基线。SynthContextgetContext(JComponent c)返回指定组件的上下文。DimensiongetMinimumSize(JComponent c)返回最小大小。DimensiongetPreferredSize(JComponent c)返回首选大小。protected DimensiongetThumbSize()返回拇指大小。protected voidinstallDefaults(JSlider slider)安装默认值。protected voidinstallListeners(JSlider slider)安装侦听器protected voidlayout()滑出滑块。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 voidrecalculateIfInsetsChanged()如果插图已更改,请重新计算。voidsetThumbLocation(int x, int y)设置拇指位置。protected voiduninstallDefaults(JSlider slider)卸载默认设置。protected voiduninstallListeners(JSlider slider)卸载侦听器。voidupdate(Graphics g, JComponent c)通知此UI代理重新绘制指定的组件。intvalueForXPosition(int xPos)返回x位置的值。intvalueForYPosition(int yPos)返回y位置的值。protected intxPositionForValue(int value)返回值的x位置。protected intyPositionForValue(int value, int trackY, int trackHeight)返回指定值的y位置。-
Methods inherited from class javax.swing.plaf.basic.BasicSliderUI
calculateContentRect, calculateFocusRect, calculateLabelRect, calculateThumbSize, calculateTickRect, calculateTrackBuffer, calculateTrackRect, createChangeListener, createComponentListener, createFocusListener, createPropertyChangeListener, createScrollListener, drawInverted, getBaselineResizeBehavior, getFocusColor, getHeightOfHighValueLabel, getHeightOfLowValueLabel, getHeightOfTallestLabel, getHighestValue, getHighestValueLabel, getHighlightColor, getLowestValue, getLowestValueLabel, getMaximumSize, getMinimumHorizontalSize, getMinimumVerticalSize, getPreferredHorizontalSize, getPreferredVerticalSize, getShadowColor, getTickLength, getWidthOfHighValueLabel, getWidthOfLowValueLabel, getWidthOfWidestLabel, installKeyboardActions, installUI, isDragging, labelsHaveSameBaselines, paintFocus, paintHorizontalLabel, paintLabels, paintMajorTickForHorizSlider, paintMajorTickForVertSlider, paintMinorTickForHorizSlider, paintMinorTickForVertSlider, paintThumb, paintTicks, paintTrack, paintVerticalLabel, recalculateIfOrientationChanged, scrollByBlock, scrollByUnit, scrollDueToClickInTrack, uninstallKeyboardActions, uninstallUI, yPositionForValue
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount
-
-
-
-
构造方法详细信息
-
SynthSliderUI
protected SynthSliderUI(JSlider c)
构造一个SynthSliderUI。- 参数
-
c- 一个滑块
-
-
方法详细信息
-
createUI
public static ComponentUI createUI(JComponent c)
为给定的组件创建一个新的UI对象。- 参数
-
c- 为其创建UI对象的组件 - 结果
- UI对象
-
installDefaults
protected void installDefaults(JSlider slider)
安装默认值。- 重写:
-
installDefaults在BasicSliderUI - 参数
-
slider- 一个滑块
-
uninstallDefaults
protected void uninstallDefaults(JSlider slider)
卸载默认设置。 卸载LookAndFeel时会调用此方法。- 重写:
-
uninstallDefaults在BasicSliderUI - 参数
-
slider- 一个滑块
-
installListeners
protected void installListeners(JSlider slider)
安装侦听器- 重写:
-
installListeners在BasicSliderUI - 参数
-
slider- 一个滑块
-
uninstallListeners
protected void uninstallListeners(JSlider slider)
卸载侦听器。- 重写:
-
uninstallListeners在BasicSliderUI - 参数
-
slider- 一个滑块
-
createTrackListener
protected BasicSliderUI.TrackListener createTrackListener(JSlider s)
创建一个轨道监听器。- 重写:
-
createTrackListener在BasicSliderUI - 参数
-
s- 一个滑块 - 结果
- 轨道听众
-
getBaseline
public int getBaseline(JComponent c, int width, int height)
返回基线。- 重写:
-
getBaseline在BasicSliderUI - 参数
-
c-JComponent正在请求基准 -
width- 获取基准的宽度 -
height- 获取基准的高度 - 结果
- 基线或值<0表示没有合理的基线
- 另请参见:
-
JComponent.getBaseline(int, int)
-
getPreferredSize
public Dimension getPreferredSize(JComponent c)
返回首选大小。- 重写:
-
getPreferredSize中的BasicSliderUI - 参数
-
c- 一个组件 - 结果
- 优选尺寸
- 另请参见:
-
JComponent.getPreferredSize(),LayoutManager.preferredLayoutSize(java.awt.Container)
-
getMinimumSize
public Dimension getMinimumSize(JComponent c)
返回最小大小。
-
calculateGeometry
protected void calculateGeometry()
计算几何。
-
layout
protected void layout()
滑出滑块。
-
calculateThumbLocation
protected void calculateThumbLocation()
计算拇指位置。
-
setThumbLocation
public void setThumbLocation(int x, int y)设置拇指位置。- 重写:
-
setThumbLocation在BasicSliderUI - 参数
-
x- x坐标 -
y- y坐标
-
xPositionForValue
protected int xPositionForValue(int value)
返回值的x位置。- 重写:
-
xPositionForValue在BasicSliderUI - 参数
-
value- 值 - 结果
- 一个值的x位置
-
yPositionForValue
protected int yPositionForValue(int value, int trackY, int trackHeight)返回指定值的y位置。 没有对参数进行检查。 特别是如果trackHeight为负,则可能会出现未定义的结果。- 重写:
-
yPositionForValue在BasicSliderUI - 参数
-
value- 获取位置的滑块值 -
trackY- 轨道的y起点 -
trackHeight- 轨道的高度 - 结果
- 滑块的指定值的y位置
-
valueForYPosition
public int valueForYPosition(int yPos)
返回y位置的值。 如果yPos超出了底部或顶部的轨道,则该方法将该值设置为滑块的最小值或最大值,具体取决于滑块是否反转。- 重写:
-
valueForYPosition在BasicSliderUI - 参数
-
yPos- 滑块沿y轴的位置 - 结果
- 在y位置的值
-
valueForXPosition
public int valueForXPosition(int xPos)
返回x位置的值。 如果xPos超出了左侧或右侧的轨迹,则该方法将该值设置为滑块的最小值或最大值,具体取决于滑块是否反转。- 重写:
-
valueForXPosition在BasicSliderUI - 参数
-
xPos- 滑块沿x轴的位置 - 结果
- x位置的值
-
getThumbSize
protected Dimension getThumbSize()
返回拇指大小。- 重写:
-
getThumbSize在BasicSliderUI - 结果
- 拇指大小
-
recalculateIfInsetsChanged
protected void recalculateIfInsetsChanged()
如果插图已更改,请重新计算。
-
getContext
public SynthContext getContext(JComponent c)
返回指定组件的上下文。- Specified by:
-
getContext在接口SynthUI - 参数
-
c- 组件请求SynthContext。 - 结果
- SynthContext描述组件。
-
update
public void update(Graphics g, JComponent c)
通知此UI代理重新绘制指定的组件。 该方法描述了组件背景,然后调用paint(SynthContext,Graphics)方法。通常,此方法不需要被子类覆盖。 所有Look和Feel渲染代码都应该在
paint。- 重写:
-
updateComponentUI - 参数
-
g- 用于绘画的Graphics对象 -
c- 正在涂漆的组件 - 另请参见:
-
paint(SynthContext,Graphics)
-
paint
public void paint(Graphics g, JComponent c)
根据外观和外观绘制指定的组件。Synth Look and Feel不使用此方法。 绘画由
paint(SynthContext,Graphics)处理。- 重写:
-
paint在BasicSliderUI - 参数
-
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- 边框的高度
-
paintThumb
protected void paintThumb(SynthContext context, Graphics g, Rectangle thumbBounds)
绘制滑块拇指。- 参数
-
context- 正在绘制的组件的上下文 -
g-Graphics用于绘画的对象 -
thumbBounds- 用于拇指的边框
-
paintTrack
protected void paintTrack(SynthContext context, Graphics g, Rectangle trackBounds)
绘制滑块轨道。- 参数
-
context- 正在绘制的组件的上下文 -
g-Graphics用于绘画的对象 -
trackBounds- 轨道的边框
-
propertyChange
public void propertyChange(PropertyChangeEvent e)
当绑定属性更改时,此方法将被调用。- Specified by:
-
propertyChange在接口PropertyChangeListener - 参数
-
e- 描述事件源和已更改的属性的PropertyChangeEvent对象。
-
-