java.lang.Object
javax.swing.border.AbstractBorder
javax.swing.border.LineBorder
- 所有已实现的接口:
Serializable
,Border
实现任意粗细和单一颜色的线条边框的类。
Warning: 此类的序列化对象将与未来的 Swing 版本不兼容。当前的序列化支持适用于运行相同版本 Swing 的应用程序之间的短期存储或 RMI。从 1.4 开始,对所有 JavaBeans 的长期存储的支持已添加到 java.beans
包中。请参阅 XMLEncoder
。
-
字段摘要
字段 -
构造方法总结
构造方法构造方法描述LineBorder
(Color color) 创建具有指定颜色且粗细 = 1 的线条边框。LineBorder
(Color color, int thickness) 创建具有指定颜色和粗细的线条边框。LineBorder
(Color color, int thickness, boolean roundedCorners) 创建具有指定颜色、粗细和角形状的线条边框。 -
方法总结
修饰符和类型方法描述static Border
获取厚度为 1 的 Color.black LineBorder 的便捷方法。static Border
获取厚度为 1 的 Color.gray LineBorder 的便捷方法。getBorderInsets
(Component c, Insets insets) 使用此边框的当前 Insets 重新初始化 insets 参数。返回边框的颜色。boolean
返回此边框是否将绘制成圆角。int
返回边框的厚度。boolean
返回边框是否不透明。void
paintBorder
(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
边框的颜色。 -
roundedCorners
protected boolean roundedCorners边框是否有圆角。
-
-
构造方法详细信息
-
LineBorder
创建具有指定颜色且粗细 = 1 的线条边框。- 参数:
color
- 边框颜色
-
LineBorder
创建具有指定颜色和粗细的线条边框。- 参数:
color
- 边框的颜色thickness
- 边框的粗细
-
LineBorder
@ConstructorProperties ({"lineColor","thickness","roundedCorners"}) public LineBorder(Color color, int thickness, boolean roundedCorners) 创建具有指定颜色、粗细和角形状的线条边框。- 参数:
color
- 边框的颜色thickness
- 边框的粗细roundedCorners
- 边界角是否应该是圆的- 自从:
- 1.3
-
-
方法详情
-
createBlackLineBorder
获取厚度为 1 的 Color.black LineBorder 的便捷方法。- 返回:
LineBorder
和Color.black
厚度为 1
-
createGrayLineBorder
获取厚度为 1 的 Color.gray LineBorder 的便捷方法。- 返回:
LineBorder
和Color.gray
厚度为 1
-
paintBorder
使用指定的位置和大小绘制指定组件的边框。- 指定者:
paintBorder
在接口Border
中- 重写:
paintBorder
在类AbstractBorder
中- 参数:
c
- 为其绘制边框的组件g
- 油漆图形x
- 绘制边框的 x 位置y
- 绘制边框的 y 位置width
- 绘制边框的宽度height
- 绘制边框的高度
-
getBorderInsets
使用此边框的当前 Insets 重新初始化 insets 参数。- 重写:
getBorderInsets
在类AbstractBorder
中- 参数:
c
- 此边框插入值适用的组件insets
- 要重新初始化的对象- 返回:
insets
对象- 抛出:
NullPointerException
- 如果指定的insets
是null
-
getLineColor
返回边框的颜色。- 返回:
-
一个
Color
对象代表这个对象的颜色
-
getThickness
public int getThickness()返回边框的厚度。- 返回:
- 这个边框的厚度
-
getRoundedCorners
public boolean getRoundedCorners()返回此边框是否将绘制成圆角。- 返回:
true
如果这个边框应该有圆角- 自从:
- 1.3
-
isBorderOpaque
public boolean isBorderOpaque()返回边框是否不透明。- 指定者:
isBorderOpaque
在接口Border
中- 重写:
isBorderOpaque
在类AbstractBorder
中- 返回:
true
如果边框不透明,false
否则
-