模块 java.desktop

类 LineBorder

所有已实现的接口:
Serializable , Border
已知子类:
BorderUIResource.LineBorderUIResource

public class LineBorder extends AbstractBorder
实现任意粗细和单一颜色的线条边框的类。

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

  • 字段详细信息

    • thickness

      protected int thickness
      边框的厚度。
    • lineColor

      protected Color  lineColor
      边框的颜色。
    • roundedCorners

      protected boolean roundedCorners
      边框是否有圆角。
  • 构造方法详细信息

    • LineBorder

      public LineBorder(Color  color)
      创建具有指定颜色且粗细 = 1 的线条边框。
      参数:
      color - 边框颜色
    • LineBorder

      public LineBorder(Color  color, int thickness)
      创建具有指定颜色和粗细的线条边框。
      参数:
      color - 边框的颜色
      thickness - 边框的粗细
    • LineBorder

      @ConstructorProperties ({"lineColor","thickness","roundedCorners"}) public LineBorder(Color  color, int thickness, boolean roundedCorners)
      创建具有指定颜色、粗细和角形状的线条边框。
      参数:
      color - 边框的颜色
      thickness - 边框的粗细
      roundedCorners - 边界角是否应该是圆的
      自从:
      1.3
  • 方法详情

    • createBlackLineBorder

      public static Border  createBlackLineBorder()
      获取厚度为 1 的 Color.black LineBorder 的便捷方法。
      返回:
      LineBorderColor.black 厚度为 1
    • createGrayLineBorder

      public static Border  createGrayLineBorder()
      获取厚度为 1 的 Color.gray LineBorder 的便捷方法。
      返回:
      LineBorderColor.gray 厚度为 1
    • paintBorder

      public void paintBorder(Component  c, Graphics  g, int x, int y, int width, int height)
      使用指定的位置和大小绘制指定组件的边框。
      指定者:
      paintBorder 在接口 Border
      重写:
      paintBorder 在类 AbstractBorder
      参数:
      c - 为其绘制边框的组件
      g - 油漆图形
      x - 绘制边框的 x 位置
      y - 绘制边框的 y 位置
      width - 绘制边框的宽度
      height - 绘制边框的高度
    • getBorderInsets

      public Insets  getBorderInsets(Component  c, Insets  insets)
      使用此边框的当前 Insets 重新初始化 insets 参数。
      重写:
      getBorderInsets 在类 AbstractBorder
      参数:
      c - 此边框插入值适用的组件
      insets - 要重新初始化的对象
      返回:
      insets 对象
      抛出:
      NullPointerException - 如果指定的 insetsnull
    • getLineColor

      public Color  getLineColor()
      返回边框的颜色。
      返回:
      一个 Color 对象代表这个对象的颜色
    • getThickness

      public int getThickness()
      返回边框的厚度。
      返回:
      这个边框的厚度
    • getRoundedCorners

      public boolean getRoundedCorners()
      返回此边框是否将绘制成圆角。
      返回:
      true 如果这个边框应该有圆角
      自从:
      1.3
    • isBorderOpaque

      public boolean isBorderOpaque()
      返回边框是否不透明。
      指定者:
      isBorderOpaque 在接口 Border
      重写:
      isBorderOpaque 在类 AbstractBorder
      返回:
      true 如果边框不透明,false 否则