模块 java.desktop

类 BasicSliderUI

已知子类:
MetalSliderUI , SynthSliderUI

public class BasicSliderUI extends SliderUI
SliderUI 的基本 L&F 实现。
  • 字段详细信息

    • POSITIVE_SCROLL

      public static final int POSITIVE_SCROLL
      正面卷轴
      参见:
    • NEGATIVE_SCROLL

      public static final int NEGATIVE_SCROLL
      负滚动
      参见:
    • MIN_SCROLL

      public static final int MIN_SCROLL
      最小滚动
      参见:
    • MAX_SCROLL

      public static final int MAX_SCROLL
      最大滚动
      参见:
    • scrollTimer

      protected Timer  scrollTimer
      滚动计时器
    • slider

      protected JSlider  slider
      滑块
    • focusInsets

      protected Insets  focusInsets
      焦点insets
    • insetCache

      protected Insets  insetCache
      插入缓存
    • leftToRightCache

      protected boolean leftToRightCache
      从左到右缓存
    • focusRect

      protected Rectangle  focusRect
      焦点矩形
    • contentRect

      protected Rectangle  contentRect
      Content 矩形
    • labelRect

      protected Rectangle  labelRect
      Label 矩形
    • tickRect

      protected Rectangle  tickRect
      勾选矩形
    • trackRect

      protected Rectangle  trackRect
      Track 矩形
    • thumbRect

      protected Rectangle  thumbRect
      Thumb 矩形
    • trackBuffer

      protected int trackBuffer
      轨道距离控件一侧的距离
    • trackListener

      protected BasicSliderUI.TrackListener  trackListener
      跟踪监听
    • changeListener

      protected ChangeListener  changeListener
      更改监听
    • componentListener

      protected ComponentListener  componentListener
      组件监听
    • focusListener

      protected FocusListener  focusListener
      焦点听众
    • scrollListener

      protected BasicSliderUI.ScrollListener  scrollListener
      滚动监听
    • propertyChangeListener

      protected PropertyChangeListener  propertyChangeListener
      属性变化监听
  • 构造方法详细信息

    • BasicSliderUI

      public BasicSliderUI()
      构造一个 BasicSliderUI
    • BasicSliderUI

      public BasicSliderUI(JSlider  b)
      构造一个 BasicSliderUI
      参数:
      b - 滑块
  • 方法详情

    • getShadowColor

      protected Color  getShadowColor()
      返回阴影颜色。
      返回:
      阴影颜色
    • getHighlightColor

      protected Color  getHighlightColor()
      返回突出显示颜色。
      返回:
      高亮颜色
    • getFocusColor

      protected Color  getFocusColor()
      返回焦点颜色。
      返回:
      焦点颜色
    • isDragging

      protected boolean isDragging()
      如果用户正在拖动滑块,则返回 true。
      返回:
      如果用户正在拖动滑块,则为真
      自从:
      1.5
    • createUI

      public static ComponentUI  createUI(JComponent  b)
      创建一个用户界面。
      参数:
      b - 一个组件
      返回:
      一个用户界面
    • installUI

      public void installUI(JComponent  c)
      安装一个 UI。
      重写:
      installUI 在类 ComponentUI
      参数:
      c - 一个组件
      参见:
    • uninstallUI

      public void uninstallUI(JComponent  c)
      卸载 UI。
      重写:
      uninstallUI 在类 ComponentUI
      参数:
      c - 一个组件
      参见:
    • installDefaults

      protected void installDefaults(JSlider  slider)
      安装默认值。
      参数:
      slider - 滑块
    • uninstallDefaults

      protected void uninstallDefaults(JSlider  slider)
      卸载默认值。
      参数:
      slider - 滑块
    • createTrackListener

      protected BasicSliderUI.TrackListener  createTrackListener(JSlider  slider)
      创建一个轨道监听。
      参数:
      slider - 滑块
      返回:
      轨道听众
    • createChangeListener

      protected ChangeListener  createChangeListener(JSlider  slider)
      创建一个更改监听。
      参数:
      slider - 滑块
      返回:
      改变监听
    • createComponentListener

      protected ComponentListener  createComponentListener(JSlider  slider)
      创建复合监听。
      参数:
      slider - 滑块
      返回:
      复合监听
    • createFocusListener

      protected FocusListener  createFocusListener(JSlider  slider)
      创建一个焦点监听。
      参数:
      slider - 滑块
      返回:
      专注的倾听者
    • createScrollListener

      protected BasicSliderUI.ScrollListener  createScrollListener(JSlider  slider)
      创建滚动监听。
      参数:
      slider - 滑块
      返回:
      滚动监听
    • createPropertyChangeListener

      protected PropertyChangeListener  createPropertyChangeListener(JSlider  slider)
      创建属性更改监听。
      参数:
      slider - 滑块
      返回:
      属性更改监听
    • installListeners

      protected void installListeners(JSlider  slider)
      安装监听。
      参数:
      slider - 滑块
    • uninstallListeners

      protected void uninstallListeners(JSlider  slider)
      卸载监听。
      参数:
      slider - 滑块
    • installKeyboardActions

      protected void installKeyboardActions(JSlider  slider)
      安装键盘操作。
      参数:
      slider - 滑块
    • uninstallKeyboardActions

      protected void uninstallKeyboardActions(JSlider  slider)
      卸载键盘操作。
      参数:
      slider - 滑块
    • getBaseline

      public int getBaseline(JComponent  c, int width, int height)
      返回基线。
      重写:
      getBaseline 在类 ComponentUI
      参数:
      c - JComponent 正在请求基线
      width - 获取基线的宽度
      height - 获取基线的高度
      返回:
      基线或值 < 0 表示没有合理的基线
      抛出:
      NullPointerException - 如果 cnull
      IllegalArgumentException - 如果宽度或高度 < 0
      自从:
      1.6
      参见:
    • getBaselineResizeBehavior

      public Component.BaselineResizeBehavior  getBaselineResizeBehavior(JComponent  c)
      返回一个枚举,指示组件的基线如何随着大小的变化而变化。
      重写:
      getBaselineResizeBehavior 在类 ComponentUI
      参数:
      c - JComponent 返回基线调整大小行为
      返回:
      一个枚举,指示基线如何随着组件大小的变化而变化
      抛出:
      NullPointerException - 如果 cnull
      自从:
      1.6
      参见:
    • labelsHaveSameBaselines

      protected boolean labelsHaveSameBaselines()
      如果标签表中的所有标签都具有相同的基线,则返回 true。
      返回:
      如果标签表中的所有标签都具有相同的基线,则为真
      自从:
      1.6
    • getPreferredHorizontalSize

      public Dimension  getPreferredHorizontalSize()
      返回首选水平尺寸。
      返回:
      首选水平尺寸
    • getPreferredVerticalSize

      public Dimension  getPreferredVerticalSize()
      返回首选的垂直尺寸。
      返回:
      首选垂直尺寸
    • getMinimumHorizontalSize

      public Dimension  getMinimumHorizontalSize()
      返回最小水平尺寸。
      返回:
      最小水平尺寸
    • getMinimumVerticalSize

      public Dimension  getMinimumVerticalSize()
      返回最小垂直尺寸。
      返回:
      最小垂直尺寸
    • getPreferredSize

      public Dimension  getPreferredSize(JComponent  c)
      返回首选大小。
      重写:
      getPreferredSize 在类 ComponentUI
      参数:
      c - 一个组件
      返回:
      首选尺寸
      参见:
    • getMinimumSize

      public Dimension  getMinimumSize(JComponent  c)
      返回最小尺寸。
      重写:
      getMinimumSize 在类 ComponentUI
      参数:
      c - 一个组件
      返回:
      最小尺寸
      参见:
    • getMaximumSize

      public Dimension  getMaximumSize(JComponent  c)
      返回最大尺寸。
      重写:
      getMaximumSize 在类 ComponentUI
      参数:
      c - 一个组件
      返回:
      最大尺寸
      参见:
    • calculateGeometry

      protected void calculateGeometry()
      计算几何。
    • calculateFocusRect

      protected void calculateFocusRect()
      计算焦点矩形。
    • calculateThumbSize

      protected void calculateThumbSize()
      计算拇指大小的矩形。
    • calculateContentRect

      protected void calculateContentRect()
      计算内容矩形。
    • calculateThumbLocation

      protected void calculateThumbLocation()
      计算拇指位置。
    • calculateTrackBuffer

      protected void calculateTrackBuffer()
      计算轨道缓冲区。
    • calculateTrackRect

      protected void calculateTrackRect()
      计算轨道矩形。
    • getTickLength

      protected int getTickLength()
      获取水平滑块刻度区域的高度和垂直滑块刻度区域的宽度。 BasicSliderUI 使用返回值来确定刻度区域矩形。如果你想给你的蜱虫一些空间,让它比你需要的更大,并在 paintTicks() 中将你的蜱虫从侧面涂掉。
      返回:
      表示水平滑块刻度区域高度和垂直滑块刻度区域宽度的整数
    • calculateTickRect

      protected void calculateTickRect()
      计算刻度矩形。
    • calculateLabelRect

      protected void calculateLabelRect()
      计算标签矩形。
    • getThumbSize

      protected Dimension  getThumbSize()
      返回拇指大小。
      返回:
      拇指大小
    • getWidthOfWidestLabel

      protected int getWidthOfWidestLabel()
      返回最宽标签的宽度。
      返回:
      最宽标签的宽度
    • getHeightOfTallestLabel

      protected int getHeightOfTallestLabel()
      返回最高标签的高度。
      返回:
      最高标签的高度
    • getWidthOfHighValueLabel

      protected int getWidthOfHighValueLabel()
      返回最大值标签的宽度。
      返回:
      最高值标签的宽度
    • getWidthOfLowValueLabel

      protected int getWidthOfLowValueLabel()
      返回最低值标签的宽度。
      返回:
      最低值标签的宽度
    • getHeightOfHighValueLabel

      protected int getHeightOfHighValueLabel()
      返回最大值标签的高度。
      返回:
      最高值标签的高度
    • getHeightOfLowValueLabel

      protected int getHeightOfLowValueLabel()
      返回最低值标签的高度。
      返回:
      最低值标签的高度
    • drawInverted

      protected boolean drawInverted()
      倒着画。
      返回:
      颠倒性
    • getHighestValue

      protected Integer  getHighestValue()
      返回在标签表中有条目的最大值。
      返回:
      在标签表中有一个条目的最大值,或者为空。
      自从:
      1.6
    • getLowestValue

      protected Integer  getLowestValue()
      返回在标签表中具有条目的最小值。
      返回:
      在标签表中有条目的最小值,或者为空。
      自从:
      1.6
    • getLowestValueLabel

      protected Component  getLowestValueLabel()
      返回与标签表中最高滑块值对应的标签。
      返回:
      与标签表中最高滑块值对应的标签
      参见:
    • getHighestValueLabel

      protected Component  getHighestValueLabel()
      返回对应于标签表中最低滑块值的标签。
      返回:
      与标签表中最低滑块值对应的标签
      参见:
    • recalculateIfInsetsChanged

      protected void recalculateIfInsetsChanged()
      如果insets已更改,则重新计算。
    • recalculateIfOrientationChanged

      protected void recalculateIfOrientationChanged()
      如果方向已更改,则重新计算。
    • paintFocus

      public void paintFocus(Graphics  g)
      油漆重点。
      参数:
      g - 图形
    • paintTrack

      public void paintTrack(Graphics  g)
      绘制跟踪.
      参数:
      g - 图形
    • paintTicks

      public void paintTicks(Graphics  g)
      油漆滴答声。
      参数:
      g - 图形
    • paintMinorTickForHorizSlider

      protected void paintMinorTickForHorizSlider(Graphics  g, Rectangle  tickBounds, int x)
      绘制水平滑块的小刻度。
      参数:
      g - 图形
      tickBounds - 滴答界限
      x - x 坐标
    • paintMajorTickForHorizSlider

      protected void paintMajorTickForHorizSlider(Graphics  g, Rectangle  tickBounds, int x)
      绘制水平滑块的主要刻度。
      参数:
      g - 图形
      tickBounds - 滴答界限
      x - x 坐标
    • paintMinorTickForVertSlider

      protected void paintMinorTickForVertSlider(Graphics  g, Rectangle  tickBounds, int y)
      绘制垂直滑块的小刻度。
      参数:
      g - 图形
      tickBounds - 滴答界限
      y - y 坐标
    • paintMajorTickForVertSlider

      protected void paintMajorTickForVertSlider(Graphics  g, Rectangle  tickBounds, int y)
      绘制垂直滑块的主要刻度。
      参数:
      g - 图形
      tickBounds - 滴答界限
      y - y 坐标
    • paintLabels

      public void paintLabels(Graphics  g)
      绘制标签。
      参数:
      g - 图形
    • paintHorizontalLabel

      protected void paintHorizontalLabel(Graphics  g, int value, Component  label)
      为标签表中的每个标签调用。用于绘制水平滑块的标签。图形已经被翻译成 labelRect.y。
      参数:
      g - 绘制的图形上下文
      value - 滑块的值
      label——标签表中需要绘制的元件标签
      参见:
    • paintVerticalLabel

      protected void paintVerticalLabel(Graphics  g, int value, Component  label)
      为标签表中的每个标签调用。用于绘制垂直滑块的标签。图形已经被翻译成 labelRect.x。
      参数:
      g - 绘制的图形上下文
      value - 滑块的值
      label——标签表中需要绘制的元件标签
      参见:
    • paintThumb

      public void paintThumb(Graphics  g)
      画拇指。
      参数:
      g - 图形
    • setThumbLocation

      public void setThumbLocation(int x, int y)
      设置拇指位置。
      参数:
      x - x 坐标
      y - y 坐标
    • scrollByBlock

      public void scrollByBlock(int direction)
      按块滚动。
      参数:
      direction - 方向
    • scrollByUnit

      public void scrollByUnit(int direction)
      按单位滚动。
      参数:
      direction - 方向
    • scrollDueToClickInTrack

      protected void scrollDueToClickInTrack(int dir)
      当在轨道中检测到 mousePressed 时调用此函数,而不是在拇指中。默认行为是按块滚动。您可以重写此方法以停止滚动或添加其他行为。
      参数:
      dir - 要滚动的方向和块数
    • xPositionForValue

      protected int xPositionForValue(int value)
      返回值的 x 位置。
      参数:
      value - 值
      返回:
      值的 x 位置
    • yPositionForValue

      protected int yPositionForValue(int value)
      返回值的 y 位置。
      参数:
      value - 值
      返回:
      值的 y 位置
    • yPositionForValue

      protected int yPositionForValue(int value, int trackY, int trackHeight)
      返回指定值的 y 位置。不对参数进行检查。特别是如果 trackHeight 为负数,则可能会出现未定义的结果。
      参数:
      value - 获取位置的滑块值
      trackY - 轨道的 y 原点
      trackHeight - 轨道的高度
      返回:
      滑块指定值的 y 位置
      自从:
      1.6
    • valueForYPosition

      public int valueForYPosition(int yPos)
      返回 y 位置的值。如果 yPos 超出底部或顶部的轨道,此方法将值设置为滑块的最小值或最大值,具体取决于滑块是否反转。
      参数:
      yPos - 滑块沿 y 轴的位置
      返回:
      y 位置的值
    • valueForXPosition

      public int valueForXPosition(int xPos)
      返回 x 位置的值。如果 xPos 超出左侧或右侧的轨道,则此方法将值设置为滑块的最小值或最大值,具体取决于滑块是否反转。
      参数:
      xPos - 滑块沿 x 轴的位置
      返回:
      x位置的值