- java.lang.Object
-
- javax.swing.border.AbstractBorder
-
- javax.swing.border.LineBorder
-
- All Implemented Interfaces:
-
Serializable,Border
public class LineBorder extends AbstractBorder
实现任意厚度和单一颜色的线边框的类。警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,对所有JavaBeans的长期存储的支持已被添加到
java.beans软件包中。 请参阅XMLEncoder。- 另请参见:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field 描述 protected ColorlineColor边框颜色protected booleanroundedCorners边界是否有圆角。protected intthickness边界厚度
-
构造方法摘要
构造方法 Constructor 描述 LineBorder(Color color)创建具有指定颜色和厚度= 1的线边框。LineBorder(Color color, int thickness)创建具有指定颜色和厚度的线边框。LineBorder(Color color, int thickness, boolean roundedCorners)创建具有指定颜色,粗细和拐角形状的线条边框。
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 static BordercreateBlackLineBorder()获取Color.black LineBorder厚度为1的便捷方法。static BordercreateGrayLineBorder()获得Color.gray LineBorder厚度为1的便捷方法。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)用指定的位置和大小绘制指定组件的边框。-
Methods inherited from class 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()
获取Color.black LineBorder厚度为1的便捷方法。- 结果
-
一个
LineBorder与Color.black和厚度1
-
createGrayLineBorder
public static Border createGrayLineBorder()
获得Color.gray LineBorder厚度为1的便捷方法。- 结果
-
一个
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参数。- 重写:
-
getBorderInsetsAbstractBorder - 参数
-
c- 此边界插入值的组件适用 -
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否则
-
-