public class BasicSliderUI extends SliderUI
| Modifier and Type | Class and Description |
|---|---|
class |
BasicSliderUI.ActionScroller
作为java 2平台V1.3这无证类不再被使用。
|
class |
BasicSliderUI.ChangeHandler
数据模型侦听器。
|
class |
BasicSliderUI.ComponentHandler
调整大小事件监听器。
|
class |
BasicSliderUI.FocusHandler
焦点改变侦听器。
|
class |
BasicSliderUI.PropertyChangeHandler |
class |
BasicSliderUI.ScrollListener
滚动事件侦听器。
|
class |
BasicSliderUI.TrackListener
跟踪鼠标动作。
|
| Modifier and Type | Field and Description |
|---|---|
protected ChangeListener |
changeListener |
protected ComponentListener |
componentListener |
protected Rectangle |
contentRect |
protected Insets |
focusInsets |
protected FocusListener |
focusListener |
protected Rectangle |
focusRect |
protected Insets |
insetCache |
protected Rectangle |
labelRect |
protected boolean |
leftToRightCache |
static int |
MAX_SCROLL |
static int |
MIN_SCROLL |
static int |
NEGATIVE_SCROLL |
static int |
POSITIVE_SCROLL |
protected PropertyChangeListener |
propertyChangeListener |
protected BasicSliderUI.ScrollListener |
scrollListener |
protected Timer |
scrollTimer |
protected JSlider |
slider |
protected Rectangle |
thumbRect |
protected Rectangle |
tickRect |
protected int |
trackBuffer |
protected BasicSliderUI.TrackListener |
trackListener |
protected Rectangle |
trackRect |
| Constructor and Description |
|---|
BasicSliderUI(JSlider b) |
contains, getAccessibleChild, getAccessibleChildrenCount, updatepublic static final int POSITIVE_SCROLL
public static final int NEGATIVE_SCROLL
public static final int MIN_SCROLL
public static final int MAX_SCROLL
protected Timer scrollTimer
protected JSlider slider
protected Insets focusInsets
protected Insets insetCache
protected boolean leftToRightCache
protected Rectangle focusRect
protected Rectangle contentRect
protected Rectangle labelRect
protected Rectangle tickRect
protected Rectangle trackRect
protected Rectangle thumbRect
protected int trackBuffer
protected BasicSliderUI.TrackListener trackListener
protected ChangeListener changeListener
protected ComponentListener componentListener
protected FocusListener focusListener
protected BasicSliderUI.ScrollListener scrollListener
protected PropertyChangeListener propertyChangeListener
public BasicSliderUI(JSlider b)
protected Color getShadowColor()
protected Color getHighlightColor()
protected Color getFocusColor()
protected boolean isDragging()
public static ComponentUI createUI(JComponent b)
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(JSlider slider)
protected void uninstallDefaults(JSlider slider)
protected BasicSliderUI.TrackListener createTrackListener(JSlider slider)
protected ChangeListener createChangeListener(JSlider slider)
protected ComponentListener createComponentListener(JSlider slider)
protected FocusListener createFocusListener(JSlider slider)
protected BasicSliderUI.ScrollListener createScrollListener(JSlider slider)
protected PropertyChangeListener createPropertyChangeListener(JSlider slider)
protected void installListeners(JSlider slider)
protected void uninstallListeners(JSlider slider)
protected void installKeyboardActions(JSlider slider)
protected void uninstallKeyboardActions(JSlider slider)
public int getBaseline(JComponent c, int width, int height)
getBaseline 方法重写,继承类
ComponentUI
c -
JComponent基线被要求
width的宽度得到基线
height -高度得到基线
null
c
NullPointerException
IllegalArgumentException如果宽度或高度小于0
JComponent.getBaseline(int, int)
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
getBaselineResizeBehavior 方法重写,继承类
ComponentUI
c -
JComponent返回基线调整行为
null
c
NullPointerException
JComponent.getBaseline(int, int)
protected boolean labelsHaveSameBaselines()
public Dimension getPreferredHorizontalSize()
public Dimension getPreferredVerticalSize()
public Dimension getMinimumHorizontalSize()
public Dimension getMinimumVerticalSize()
public Dimension getPreferredSize(JComponent c)
ComponentUI
null返回,首选大小将由组件的布局管理器的计算(这是与一个特定的布局管理器安装任何组件的首选方法)。此方法的默认实现将返回
null。
getPreferredSize 方法重写,继承类
ComponentUI
c优先度的被查询的成分;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
JComponent.getPreferredSize(),
LayoutManager.preferredLayoutSize(java.awt.Container)
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)
protected void calculateGeometry()
protected void calculateFocusRect()
protected void calculateThumbSize()
protected void calculateContentRect()
protected void calculateThumbLocation()
protected void calculateTrackBuffer()
protected void calculateTrackRect()
protected int getTickLength()
protected void calculateTickRect()
protected void calculateLabelRect()
protected Dimension getThumbSize()
protected int getWidthOfWidestLabel()
protected int getHeightOfTallestLabel()
protected int getWidthOfHighValueLabel()
protected int getWidthOfLowValueLabel()
protected int getHeightOfHighValueLabel()
protected int getHeightOfLowValueLabel()
protected boolean drawInverted()
protected Integer getHighestValue()
protected Integer getLowestValue()
protected Component getLowestValueLabel()
protected Component getHighestValueLabel()
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)
protected void recalculateIfInsetsChanged()
protected void recalculateIfOrientationChanged()
public void paintFocus(Graphics g)
public void paintTrack(Graphics g)
public void paintTicks(Graphics g)
protected void paintMinorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x)
protected void paintMajorTickForHorizSlider(Graphics g, Rectangle tickBounds, int x)
protected void paintMinorTickForVertSlider(Graphics g, Rectangle tickBounds, int y)
protected void paintMajorTickForVertSlider(Graphics g, Rectangle tickBounds, int y)
public void paintLabels(Graphics g)
protected void paintHorizontalLabel(Graphics g, int value, Component label)
protected void paintVerticalLabel(Graphics g, int value, Component label)
public void paintThumb(Graphics g)
public void setThumbLocation(int x,
int y) public void scrollByBlock(int direction)
public void scrollByUnit(int direction)
protected void scrollDueToClickInTrack(int dir)
protected int xPositionForValue(int value)
protected int yPositionForValue(int value)
protected int yPositionForValue(int value,
int trackY,
int trackHeight)
trackHeight可能出现不确定的结果是阴性的。
value去定位滑块的值
trackY -轨道y-origin
trackHeight -轨道的高度
public int valueForYPosition(int yPos)
yPos超出轨道的底部或顶部,此方法设置值为最小或滑块的最大值,这取决于如果滑块倒不。
public int valueForXPosition(int xPos)
xPos超出轨道在左或右,此方法设置值为最小或滑块的最大值,这取决于如果滑块倒不。
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.