模块 java.desktop

类 StrokeBorder

java.lang.Object
javax.swing.border.AbstractBorder
javax.swing.border.StrokeBorder
所有已实现的接口:
Serializable , Border

public class StrokeBorder extends AbstractBorder
实现任意笔画边框的类。

Warning: 此类的序列化对象将与未来的 Swing 版本不兼容。当前的序列化支持适用于运行相同版本 Swing 的应用程序之间的短期存储或 RMI。从 1.4 开始,对所有 JavaBeans 的长期存储的支持已添加到 java.beans 包中。请参阅 XMLEncoder

自从:
1.7
  • 构造方法详细信息

    • StrokeBorder

      public StrokeBorder(BasicStroke  stroke)
      创建指定 stroke 的边框。组件的前景色将用于渲染边框。
      参数:
      stroke - 用于描边形状的 BasicStroke 对象
      抛出:
      NullPointerException - 如果指定的 strokenull
    • StrokeBorder

      @ConstructorProperties ({"stroke","paint"}) public StrokeBorder(BasicStroke  stroke, Paint  paint)
      创建指定 strokepaint 的边框。如果指定的 paintnull ,组件的前景色将用于渲染边框。
      参数:
      stroke - 用于描边形状的 BasicStroke 对象
      paint - 用于生成颜色的 Paint 对象
      抛出:
      NullPointerException - 如果指定的 strokenull
  • 方法详情

    • paintBorder

      public void paintBorder(Component  c, Graphics  g, int x, int y, int width, int height)
      使用指定的位置和大小绘制指定组件的边框。如果未使用 Paint 对象指定边框,则组件的前景色将用于呈现边框。如果组件的前景色不可用,将使用 Graphics 对象的默认颜色。
      指定者:
      paintBorder 在接口 Border
      重写:
      paintBorder 在类 AbstractBorder
      参数:
      c - 为其绘制边框的组件
      g - 油漆图形
      x - 绘制边框的 x 位置
      y - 绘制边框的 y 位置
      width - 绘制边框的宽度
      height - 绘制边框的高度
      抛出:
      NullPointerException - 如果指定的 gnull
    • getBorderInsets

      public Insets  getBorderInsets(Component  c, Insets  insets)
      使用此边框的当前insets重新初始化 insets 参数。每个insets都是大于或等于用于绘制边框的笔画线宽的最小(最接近负无穷大)整数值。
      重写:
      getBorderInsets 在类 AbstractBorder
      参数:
      c - 此边框插入值适用的组件
      insets - 要重新初始化的 Insets 对象
      返回:
      重新初始化的 insets 参数
      抛出:
      NullPointerException - 如果指定的 insetsnull
      参见:
    • getStroke

      public BasicStroke  getStroke()
      返回用于在边框渲染期间描边形状的 BasicStroke 对象。
      返回:
      BasicStroke 对象
    • getPaint

      public Paint  getPaint()
      返回用于在边框渲染期间生成颜色的 Paint 对象。
      返回:
      Paint 对象或 null(如果未设置 paint 参数)