Class SmoothScroll

java.lang.Object
com.imyeyu.fx.utils.SmoothScroll

public class SmoothScroll extends Object
平滑滚动控制,使控件滚动平滑,此功能需要较多 GPU 性能

注意:虚拟滚动面板需要通过列表项计算理论可滚动高度,所以列表项必须统一高度

    SmoothScroll.textarea(new TextArea());                  // 文本域平滑滚动
    SmoothScroll.scrollPane(new ScrollPane());              // 平滑滚动面板
    SmoothScroll.virtual(new ListView());                   // 列表平滑滚动(虚拟面板平滑滚动,表格、树形结构等懒加载组件都是虚拟面板)
    SmoothScroll.reflectSkin(new TextArea(), "scrollPane"); // 自定反射皮肤平滑滚动面板(反射组件 skin 里的滚动面板)
Since:
2022-05-24 16:04
Author:
夜雨
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    comboBox(javafx.scene.control.ComboBox<?> comboBox)
    平滑滚动 ComboBox 的选项列表
    static void
    reflectSkin(javafx.scene.control.Control control, String fieldName)
    反射控件平滑滚动面板
    static void
    scrollPane(javafx.scene.control.ScrollPane scrollPane)
    平滑滚动面板
    static void
    scrollPane(javafx.scene.control.ScrollPane scrollPane, javafx.beans.property.DoubleProperty scrollProperty, Function<javafx.geometry.Bounds, Double> sizeFunc)
    平滑滚动面板
    static void
    scrollPaneH(javafx.scene.control.ScrollPane scrollPane)
    平滑水平滚动面板
    static void
    scrollPaneV(javafx.scene.control.ScrollPane scrollPane)
    平滑垂直滚动面板
    static void
    textarea(javafx.scene.control.TextArea textArea)
    文本域平滑滚动
    static void
    virtual(javafx.scene.control.Control control)
    反射控件虚拟滚动面板
    static void
    virtual(javafx.scene.control.Control control, javafx.scene.control.skin.VirtualFlow<?> virtualFlow)
    虚拟滚动面板平滑滚动

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SmoothScroll

      public SmoothScroll()
  • Method Details

    • comboBox

      public static void comboBox(javafx.scene.control.ComboBox<?> comboBox)
      平滑滚动 ComboBox 的选项列表
      Parameters:
      comboBox - 选择器
    • virtual

      public static void virtual(javafx.scene.control.Control control)
      反射控件虚拟滚动面板
      Parameters:
      control - 控件
    • virtual

      public static void virtual(javafx.scene.control.Control control, javafx.scene.control.skin.VirtualFlow<?> virtualFlow)
      虚拟滚动面板平滑滚动
      Parameters:
      control - 组件
      virtualFlow - 虚拟滚动面板
    • textarea

      public static void textarea(javafx.scene.control.TextArea textArea)
      文本域平滑滚动
      Parameters:
      textArea - 文本域
    • reflectSkin

      public static void reflectSkin(javafx.scene.control.Control control, String fieldName)
      反射控件平滑滚动面板
      Parameters:
      control - 控件
      fieldName - 反射字段
    • scrollPane

      public static void scrollPane(javafx.scene.control.ScrollPane scrollPane)
      平滑滚动面板
      Parameters:
      scrollPane - 滚动面板
    • scrollPaneV

      public static void scrollPaneV(javafx.scene.control.ScrollPane scrollPane)
      平滑垂直滚动面板
      Parameters:
      scrollPane - 滚动面板
    • scrollPaneH

      public static void scrollPaneH(javafx.scene.control.ScrollPane scrollPane)
      平滑水平滚动面板
      Parameters:
      scrollPane - 滚动面板
    • scrollPane

      public static void scrollPane(javafx.scene.control.ScrollPane scrollPane, javafx.beans.property.DoubleProperty scrollProperty, Function<javafx.geometry.Bounds, Double> sizeFunc)
      平滑滚动面板
      Parameters:
      scrollPane - 滚动面板
      scrollProperty - 滚动轴属性
      sizeFunc - 高度回调