- java.lang.Object
-
- javax.swing.border.AbstractBorder
-
- javax.swing.border.LineBorder
-
- 实现的所有接口
-
Serializable,Border
public class LineBorder extends AbstractBorder
实现任意厚度和单色的线边框的类。警告:此类的序列化对象与以后的Swing版本不兼容。 当前的序列化支持适用于运行相同版本Swing的应用程序之间的短期存储或RMI。 从1.4开始,
java.beans软件包中添加了对所有JavaBeansjava.beans长期存储的支持。 请参阅XMLEncoder。- 另请参见:
- Serialized Form
-
-
字段汇总
字段 变量和类型 字段 描述 protected ColorlineColor边框的颜色。protected booleanroundedCorners边框是否有圆角。protected intthickness边框的厚度。
-
构造方法摘要
构造方法 构造器 描述 LineBorder(Color color)创建具有指定颜色和厚度= 1的线条边框。LineBorder(Color color, int thickness)创建具有指定颜色和粗细的线条边框。LineBorder(Color color, int thickness, boolean roundedCorners)创建具有指定颜色,粗细和角形的线条边框。
-
方法摘要
所有方法 静态方法 实例方法 具体的方法 变量和类型 方法 描述 static BordercreateBlackLineBorder()获取厚度为1的Color.black LineBorder的便捷方法。static BordercreateGrayLineBorder()获取厚度为1的Color.gray LineBorder的便捷方法。InsetsgetBorderInsets(Component c, Insets insets)使用此Border的当前Insets重新初始化insets参数。ColorgetLineColor()返回边框的颜色。booleangetRoundedCorners()返回是否使用圆角绘制此边框。intgetThickness()返回边框的粗细。booleanisBorderOpaque()返回边框是否不透明。voidpaintBorder(Component c, Graphics g, int x, int y, int width, int height)使用指定的位置和大小绘制指定组件的边框。-
声明方法的类 javax.swing.border.AbstractBorder
getBaseline, getBaselineResizeBehavior, getBorderInsets, getInteriorRectangle, getInteriorRectangle
-
-
-
-
字段详细信息
-
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的便捷方法。- 结果
-
一个
LineBorder与Color.black和1厚度
-
createGrayLineBorder
public static Border createGrayLineBorder()
获取厚度为1的Color.gray LineBorder的便捷方法。- 结果
-
一个
LineBorder与Color.gray和1厚度
-
paintBorder
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
使用指定的位置和大小绘制指定组件的边框。- Specified by:
-
paintBorder,界面Border - 重写:
-
paintBorder,类AbstractBorder - 参数
-
c- 正在为其绘制边框的组件 -
g- 油漆图形 -
x- 绘边框的x位置 -
y- 绘边框的y位置 -
width- 绘边框的宽度 -
height- 彩绘边框的高度
-
getBorderInsets
public Insets getBorderInsets(Component c, Insets insets)
使用此Border的当前Insets重新初始化insets参数。- 重写:
-
getBorderInsets,类AbstractBorder - 参数
-
c- 适用此边框insets值的组件 -
insets- 要重新初始化的对象 - 结果
-
insets对象
-
getLineColor
public Color getLineColor()
返回边框的颜色。- 结果
-
表示此对象颜色的
Color对象
-
getThickness
public int getThickness()
返回边框的粗细。- 结果
- 这个边界的厚度
-
getRoundedCorners
public boolean getRoundedCorners()
返回是否使用圆角绘制此边框。- 结果
-
true如果此边框应有圆角 - 从以下版本开始:
- 1.3
-
isBorderOpaque
public boolean isBorderOpaque()
返回边框是否不透明。- Specified by:
-
isBorderOpaque,界面Border - 重写:
-
isBorderOpaque,类AbstractBorder - 结果
-
true如果边框不透明,false
-
-