Class BorderStroke

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

public class BorderStroke extends Object
快速构建边框。build() 作为导出作用,最后执行
示例
    new BorderStroke("red").build();                  // 红色边框,默认样式(1 像素宽度直线,无圆角无内边距)
    new BorderStroke("red").width(0, 1, 0, 1).build() // 红色直线左右边框
    new BorderStroke("red").top().build()             // 红色直线上边框
    new BorderStroke("red").radius(.5, true).build()  // 红色完全圆角边框
top(), right(), bottom(), left() 不可重复使用,因为这是针对性边框宽度设置,重复使用只有最后一个有效
Since:
2021-02-14 10:42
Author:
夜雨
  • Field Details

    • EMPTY

      public static final javafx.scene.layout.Border EMPTY
      空的边框
    • NONE

      public static final javafx.scene.layout.BorderStrokeStyle NONE
      无边框样式
    • SOLID

      public static final javafx.scene.layout.BorderStrokeStyle SOLID
      连续边框
    • DASHED

      public static final javafx.scene.layout.BorderStrokeStyle DASHED
      断续边框
    • DOTTED

      public static final javafx.scene.layout.BorderStrokeStyle DOTTED
      点状边框
  • Constructor Details

    • BorderStroke

      public BorderStroke(String top, String right, String bottom, String left)
      边框构造
      Parameters:
      top - 上边框颜色
      right - 右边框颜色
      bottom - 下边框颜色
      left - 左边框颜色
    • BorderStroke

      public BorderStroke(String color)
      边框构造
      Parameters:
      color - 边框颜色
    • BorderStroke

      public BorderStroke(javafx.scene.paint.Paint color)
      边框构造
      Parameters:
      color - 边框颜色
    • BorderStroke

      public BorderStroke(javafx.scene.paint.Paint top, javafx.scene.paint.Paint right, javafx.scene.paint.Paint bottom, javafx.scene.paint.Paint left)
      边框构造
      Parameters:
      top - 上边框颜色
      right - 右边框颜色
      bottom - 下边框颜色
      left - 左边框颜色
  • Method Details

    • top

      public BorderStroke top()
      1 像素上边框
      Returns:
      构造器
    • right

      public BorderStroke right()
      1 像素右边框
      Returns:
      构造器
    • bottom

      public BorderStroke bottom()
      1 像素下边框
      Returns:
      构造器
    • left

      public BorderStroke left()
      1 像素左边框
      Returns:
      构造器
    • top

      public BorderStroke top(double size)
      上边框
      Parameters:
      size - 大小
      Returns:
      构造器
    • right

      public BorderStroke right(double size)
      右边框
      Parameters:
      size - 大小
      Returns:
      构造器
    • bottom

      public BorderStroke bottom(double size)
      下边框
      Parameters:
      size - 大小
      Returns:
      构造器
    • left

      public BorderStroke left(double size)
      左边框
      Parameters:
      size - 大小
      Returns:
      构造器
    • exTop

      public BorderStroke exTop()
      除了上边框,其他设置为 1 像素边框
      Returns:
      构造器
    • exRight

      public BorderStroke exRight()
      除了右边框,其他设置为 1 像素边框
      Returns:
      构造器
    • exBottom

      public BorderStroke exBottom()
      除了下边框,其他设置为 1 像素边框
      Returns:
      构造器
    • exLeft

      public BorderStroke exLeft()
      除了左边框,其他设置为 1 像素边框
      Returns:
      构造器
    • exTop

      public BorderStroke exTop(double size)
      除了上边框,其他设置边框
      Parameters:
      size - 大小
      Returns:
      构造器
    • exRight

      public BorderStroke exRight(double size)
      除了右边框,其他设置边框
      Parameters:
      size - 大小
      Returns:
      构造器
    • exBottom

      public BorderStroke exBottom(double size)
      除了下边框,其他设置边框
      Parameters:
      size - 大小
      Returns:
      构造器
    • exLeft

      public BorderStroke exLeft(double size)
      除了左边框,其他设置边框
      Parameters:
      size - 大小
      Returns:
      构造器
    • width

      public BorderStroke width(double all)
      设置宽度
      Parameters:
      all - 所有边框
      Returns:
      构造器
    • width

      public BorderStroke width(double topBottom, double leftRight)
      设置宽度
      Parameters:
      topBottom - 上下
      leftRight - 左右
      Returns:
      构造器
    • width

      public BorderStroke width(double top, double right, double bottom, double left)
      设置宽度
      Parameters:
      top - 上
      right - 右
      bottom - 下
      left - 左
      Returns:
      构造器
    • radius

      public BorderStroke radius(double all)
      设置圆角
      Parameters:
      all - 所有大小
      Returns:
      构造器
    • radius

      public BorderStroke radius(double all, boolean asPercent)
      设置圆角
      Parameters:
      all - 所有大小
      asPercent - 是否为百分比值(默认否)
      Returns:
      构造器
    • radius

      public BorderStroke radius(double topLeft, double topRight, double bottomRight, double bottomLeft, boolean asPercent)
      设置圆角
      Parameters:
      topLeft - 左上角大小
      topRight - 右上角大小
      bottomRight - 右下角大小
      bottomLeft - 左下角大小
      asPercent - 是否为百分比值
      Returns:
      构造器
    • dashed

      public BorderStroke dashed()
      虚线样式
      Returns:
      构造器
    • dotted

      public BorderStroke dotted()
      点阵样式
      Returns:
      构造器
    • style

      public BorderStroke style(javafx.scene.layout.BorderStrokeStyle all)
      设置样式
      Parameters:
      all - 所有边框样式
      Returns:
      构造器
    • style

      public BorderStroke style(javafx.scene.layout.BorderStrokeStyle top, javafx.scene.layout.BorderStrokeStyle right, javafx.scene.layout.BorderStrokeStyle bottom, javafx.scene.layout.BorderStrokeStyle left)
      设置样式
      Parameters:
      top - 上
      right - 右
      bottom - 下
      left - 左
      Returns:
      构造器
    • padding

      public BorderStroke padding(double all)
      设置内边距
      Parameters:
      all - 所有边框内边距
      Returns:
      边框构造器
    • padding

      public BorderStroke padding(double topBottom, double leftRight)
      设置内边距
      Parameters:
      topBottom - 上下
      leftRight - 左右
      Returns:
      边框构造器
    • padding

      public BorderStroke padding(double top, double right, double bottom, double left)
      设置内边距
      Parameters:
      top - 上
      right - 右
      bottom - 下
      left - 左
      Returns:
      边框构造器
    • build

      public javafx.scene.layout.Border build()
      构造边框
      Returns:
      边框
    • test

      public static javafx.scene.layout.Border test(String color)
      快速构造测试边框
      Parameters:
      color - 颜色
      Returns:
      边框
    • test

      public static javafx.scene.layout.Border test()
      快速构造测试边框
      Returns:
      边框