模块 java.desktop

类 BasicScrollBarUI

所有已实现的接口:
LayoutManager , SwingConstants
已知子类:
MetalScrollBarUI , SynthScrollBarUI

public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager , SwingConstants
实现基本外观的 ScrollBarUI
  • 字段详细信息

    • minimumThumbSize

      protected Dimension  minimumThumbSize
      最小拇指大小
    • maximumThumbSize

      protected Dimension  maximumThumbSize
      最大拇指尺寸
    • thumbHighlightColor

      protected Color  thumbHighlightColor
      拇指高亮颜色
    • thumbLightShadowColor

      protected Color  thumbLightShadowColor
      拇指光影颜色
    • thumbDarkShadowColor

      protected Color  thumbDarkShadowColor
      拇指深色阴影颜色
    • thumbColor

      protected Color  thumbColor
      拇指颜色
    • trackColor

      protected Color  trackColor
      赛道颜色
    • trackHighlightColor

      protected Color  trackHighlightColor
      轨迹高亮颜色
    • scrollbar

      protected JScrollBar  scrollbar
      Scrollbar
    • incrButton

      protected JButton  incrButton
      增量按钮
    • decrButton

      protected JButton  decrButton
      递减按钮
    • isDragging

      protected boolean isDragging
      拖动
    • trackListener

      protected BasicScrollBarUI.TrackListener  trackListener
      跟踪监听
    • buttonListener

      protected BasicScrollBarUI.ArrowButtonListener  buttonListener
      按钮监听
    • modelListener

      protected BasicScrollBarUI.ModelListener  modelListener
      模型监听
    • thumbRect

      protected Rectangle  thumbRect
      Thumb 矩形
    • trackRect

      protected Rectangle  trackRect
      Track 矩形
    • trackHighlight

      protected int trackHighlight
      曲目亮点
    • NO_HIGHLIGHT

      protected static final int NO_HIGHLIGHT
      无亮点
      参见:
    • DECREASE_HIGHLIGHT

      protected static final int DECREASE_HIGHLIGHT
      减少高光
      参见:
    • INCREASE_HIGHLIGHT

      protected static final int INCREASE_HIGHLIGHT
      增加高光
      参见:
    • scrollListener

      protected BasicScrollBarUI.ScrollListener  scrollListener
      滚动监听
    • propertyChangeListener

      protected PropertyChangeListener  propertyChangeListener
      属性变化监听
    • scrollTimer

      protected Timer  scrollTimer
      滚动计时器
    • scrollBarWidth

      protected int scrollBarWidth
      提示宽度(垂直时)或高度(水平时)应该是多少。
      自从:
      1.7
    • incrGap

      protected int incrGap
      增量按钮和轨道之间的距离。这可能是一个负数。如果为负值,则按钮和轨道之间会发生重叠,这对异形按钮很有用。
      自从:
      1.7
    • decrGap

      protected int decrGap
      减量按钮和轨道之间的距离。这可能是一个负数。如果为负值,则按钮和轨道之间会发生重叠,这对异形按钮很有用。
      自从:
      1.7
  • 构造方法详细信息

    • BasicScrollBarUI

      public BasicScrollBarUI()
      构造一个 BasicScrollBarUI
  • 方法详情

    • createUI

      public static ComponentUI  createUI(JComponent  c)
      创建用户界面。
      参数:
      c - 组件
      返回:
      用户界面
    • configureScrollBarColors

      protected void configureScrollBarColors()
      配置滚动条颜色。
    • installUI

      public void installUI(JComponent  c)
      安装用户界面。
      重写:
      installUI 在类 ComponentUI
      参数:
      c - 组件
      参见:
    • uninstallUI

      public void uninstallUI(JComponent  c)
      卸载用户界面。
      重写:
      uninstallUI 在类 ComponentUI
      参数:
      c - 组件
      参见:
    • installDefaults

      protected void installDefaults()
      安装默认值。
    • installComponents

      protected void installComponents()
      安装组件。
    • uninstallComponents

      protected void uninstallComponents()
      卸载组件。
    • installListeners

      protected void installListeners()
      安装监听。
    • installKeyboardActions

      protected void installKeyboardActions()
      安装键盘操作。
    • uninstallKeyboardActions

      protected void uninstallKeyboardActions()
      卸载键盘操作。
    • uninstallListeners

      protected void uninstallListeners()
      卸载监听。
    • uninstallDefaults

      protected void uninstallDefaults()
      卸载默认值。
    • createTrackListener

      protected BasicScrollBarUI.TrackListener  createTrackListener()
      创建一个轨道监听。
      返回:
      轨道听众
    • createArrowButtonListener

      protected BasicScrollBarUI.ArrowButtonListener  createArrowButtonListener()
      创建一个箭头按钮监听。
      返回:
      箭头按钮监听
    • createModelListener

      protected BasicScrollBarUI.ModelListener  createModelListener()
      创建模型监听。
      返回:
      模范听众
    • createScrollListener

      protected BasicScrollBarUI.ScrollListener  createScrollListener()
      创建滚动监听。
      返回:
      滚动监听
    • createPropertyChangeListener

      protected PropertyChangeListener  createPropertyChangeListener()
      创建属性更改监听。
      返回:
      属性更改监听
    • setThumbRollover

      protected void setThumbRollover(boolean active)
      设置鼠标当前是否在拇指上方。
      参数:
      active - True 表示拇指当前处于活动状态。
      自从:
      1.5
    • isThumbRollover

      public boolean isThumbRollover()
      如果鼠标当前位于拇指上方,则返回 true。
      返回:
      如果拇指当前处于活动状态则为真
      自从:
      1.5
    • getPreferredSize

      public Dimension  getPreferredSize(JComponent  c)
      垂直滚动条的首选宽度是(非 null )增量/减量按钮的首选宽度的最大值,以及拇指的最小宽度。优选高度是相同部件的优选高度之和。水平滚动条的首选大小的基础是相似的。

      preferredSize 仅计算一次,对该方法的后续调用仅返回缓存大小。

      重写:
      getPreferredSize 在类 ComponentUI
      参数:
      c - 将此方法委托给我们的 JScrollBar
      返回:
      Basic JScrollBar 的首选大小
      参见:
    • getMaximumSize

      public Dimension  getMaximumSize(JComponent  c)
      从类复制的描述:ComponentUI
      返回适合外观的指定组件的最大尺寸。如果返回 null,则最大尺寸将由组件的布局管理器计算(这是安装了特定布局管理器的任何组件的首选方法)。此方法的默认实现调用 getPreferredSize 并返回该值。
      重写:
      getMaximumSize 在类 ComponentUI
      参数:
      c - 将此方法委托给我们的 JScrollBar。
      返回:
      新维度(整数.MAX_VALUE,整数.MAX_VALUE);
      参见:
    • createDecreaseButton

      protected JButton  createDecreaseButton(int orientation)
      创建一个减少按钮。
      参数:
      orientation - 方向
      返回:
      一个减少按钮
    • createIncreaseButton

      protected JButton  createIncreaseButton(int orientation)
      创建一个增加按钮。
      参数:
      orientation - 方向
      返回:
      增加按钮
    • paintDecreaseHighlight

      protected void paintDecreaseHighlight(Graphics  g)
      绘制减少高光。
      参数:
      g - 图形
    • paintIncreaseHighlight

      protected void paintIncreaseHighlight(Graphics  g)
      绘制增加高光。
      参数:
      g - 图形
    • paintTrack

      protected void paintTrack(Graphics  g, JComponent  c, Rectangle  trackBounds)
      绘制轨道。
      参数:
      g - 图形
      c - 组件
      trackBounds - 轨道边界
    • paintThumb

      protected void paintThumb(Graphics  g, JComponent  c, Rectangle  thumbBounds)
      画拇指。
      参数:
      g - 图形
      c - 组件
      thumbBounds - 拇指边界
    • getMinimumThumbSize

      protected Dimension  getMinimumThumbSize()
      返回拇指可接受的最小尺寸。如果滚动条变得太小以至于无法使用此尺寸,则缩略图将被隐藏。

      警告:不应修改此方法返回的值,它是一个共享静态常量。

      返回:
      拇指可接受的最小尺寸。
      参见:
    • getMaximumThumbSize

      protected Dimension  getMaximumThumbSize()
      返回 thumb 可接受的最大尺寸。要创建固定大小的拇指,请使此方法和 getMinimumThumbSize 返回相同的值。

      警告:不应修改此方法返回的值,它是一个共享静态常量。

      返回:
      拇指可接受的最大尺寸。
      参见:
    • addLayoutComponent

      public void addLayoutComponent(String  name, Component  child)
      从接口 LayoutManager 复制的描述
      如果布局管理器使用每个组件字符串,则将组件 comp 添加到布局中,将其与 name 指定的字符串相关联。
      指定者:
      addLayoutComponent 在接口 LayoutManager
      参数:
      name - 要与组件关联的字符串
      child - 要添加的组件
    • removeLayoutComponent

      public void removeLayoutComponent(Component  child)
      从接口 LayoutManager 复制的描述
      从布局中移除指定的组件。
      指定者:
      removeLayoutComponent 在接口 LayoutManager
      参数:
      child - 要删除的组件
    • preferredLayoutSize

      public Dimension  preferredLayoutSize(Container  scrollbarContainer)
      从接口 LayoutManager 复制的描述
      给定容器包含的组件,计算指定容器的首选尺寸。
      指定者:
      preferredLayoutSize 在接口 LayoutManager
      参数:
      scrollbarContainer - 要布置的容器
      返回:
      容器的首选尺寸
      参见:
    • minimumLayoutSize

      public Dimension  minimumLayoutSize(Container  scrollbarContainer)
      从接口 LayoutManager 复制的描述
      给定容器包含的组件,计算指定容器的最小尺寸。
      指定者:
      minimumLayoutSize 在接口 LayoutManager
      参数:
      scrollbarContainer - 要布局的组件
      返回:
      容器的最小尺寸
      参见:
    • layoutVScrollbar

      protected void layoutVScrollbar(JScrollBar  sb)
      布置一个垂直滚动条。
      参数:
      sb - 滚动条
    • layoutHScrollbar

      protected void layoutHScrollbar(JScrollBar  sb)
      布置一个水平滚动条。
      参数:
      sb - 滚动条
    • layoutContainer

      public void layoutContainer(Container  scrollbarContainer)
      从接口 LayoutManager 复制的描述
      布置指定的容器。
      指定者:
      layoutContainer 在接口 LayoutManager
      参数:
      scrollbarContainer - 要布置的容器
    • setThumbBounds

      protected void setThumbBounds(int x, int y, int width, int height)
      设置拇指的边界并强制重新绘制包括旧的 thumbBounds 和新的。
      参数:
      x - 设置拇指的 x 位置
      y - 设置拇指的 y 位置
      width - 设置拇指的宽度
      height - 设置拇指的高度
      参见:
    • getThumbBounds

      protected Rectangle  getThumbBounds()
      返回拇指的当前大小/位置。

      警告:不应修改此方法返回的值,它是对实际矩形的引用,而不是副本。

      返回:
      拇指的当前大小/位置。
      参见:
    • getTrackBounds

      protected Rectangle  getTrackBounds()
      返回轨道的当前边界,即递增和递减按钮之间的空间,减去insets。每次滚动条布局(验证)时,此方法返回的值都会更新。

      警告:不应修改此方法返回的值,它是对实际矩形的引用,而不是副本。

      返回:
      滚动条轨道的当前边界
      参见:
    • scrollByBlock

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

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

      public boolean getSupportsAbsolutePositioning()
      指示用户是否可以使用鼠标手势(通常是鼠标中键)绝对定位拇指。
      返回:
      如果鼠标手势可以绝对定位拇指,则为真
      自从:
      1.5