java.lang.Object
javax.swing.border.AbstractBorder
javax.swing.border.LineBorder
- 所有已实现的接口:
-
Serializable,Border
一个实现任意厚度和单一颜色的线边框的类。
警告: 该类的序列化对象将不兼容未来的Swing版本。当前的序列化支持适用于短期存储或在运行相同Swing版本的应用程序之间的RMI。从1.4开始,已将对所有JavaBeans的长期存储支持添加到java.beans包中。请参见XMLEncoder。
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Color边框的颜色。protected boolean边框是否具有圆角。protected int边框的厚度。 -
Constructor Summary
ConstructorsConstructorDescriptionLineBorder(Color color) 使用指定的颜色和厚度= 1创建线边框。LineBorder(Color color, int thickness) 使用指定的颜色和厚度创建线边框。LineBorder(Color color, int thickness, boolean roundedCorners) 使用指定的颜色、厚度和角形创建线边框。 -
Method Summary
Modifier and TypeMethodDescriptionstatic Border获取颜色为Color.black、厚度为1的LineBorder的便捷方法。static Border获取颜色为Color.gray、厚度为1的LineBorder的便捷方法。getBorderInsets(Component c, Insets insets) 使用此边框的当前Insets重新初始化insets参数。返回边框的颜色。boolean返回此边框是否将以圆角绘制。int返回边框的厚度。boolean返回边框是否不透明。voidpaintBorder(Component c, Graphics g, int x, int y, int width, int height) 使用指定的位置和大小为指定组件绘制边框。Methods declared in class javax.swing.border.AbstractBorder
getBaseline, getBaselineResizeBehavior, getBorderInsets, getInteriorRectangle, getInteriorRectangle
-
Field Details
-
thickness
protected int thickness边框的厚度。 -
lineColor
边框的颜色。 -
roundedCorners
protected boolean roundedCorners边框是否具有圆角。
-
-
Constructor Details
-
LineBorder
使用指定的颜色和厚度= 1创建线边框。- 参数:
-
color- 边框的颜色
-
LineBorder
使用指定的颜色和厚度创建线边框。- 参数:
-
color- 边框的颜色 -
thickness- 边框的厚度
-
LineBorder
@ConstructorProperties({"lineColor","thickness","roundedCorners"}) public LineBorder(Color color, int thickness, boolean roundedCorners) 使用指定的颜色、厚度和角形创建线边框。- 参数:
-
color- 边框的颜色 -
thickness- 边框的厚度 -
roundedCorners- 边框角是否应为圆角 - 自1.3起:
- 1.3
-
-
Method Details
-
createBlackLineBorder
获取颜色为Color.black、厚度为1的LineBorder的便捷方法。- 返回:
-
一个具有
Color.black和厚度为1的LineBorder
-
createGrayLineBorder
获取颜色为Color.gray、厚度为1的LineBorder的便捷方法。- 返回:
-
一个具有
Color.gray和厚度为1的LineBorder
-
paintBorder
使用指定的位置和大小为指定组件绘制边框。- 指定者:
-
paintBorder在接口Border中 - 覆盖:
-
paintBorder在类AbstractBorder中 - 参数:
-
c- 正在绘制此边框的组件 -
g- 绘制图形 -
x- 绘制边框的x位置 -
y- 绘制边框的y位置 -
width- 绘制边框的宽度 -
height- 绘制边框的高度
-
getBorderInsets
使用此边框的当前Insets重新初始化insets参数。- 覆盖:
-
getBorderInsets在类AbstractBorder中 - 参数:
-
c- 适用于此边框insets值的组件 -
insets- 要重新初始化的对象 - 返回:
-
insets对象 - 抛出:
-
NullPointerException- 如果指定的insets为null
-
getLineColor
返回边框的颜色。- 返回:
-
代表此对象颜色的
Color对象
-
getThickness
public int getThickness()返回边框的厚度。- 返回:
- 此边框的厚度
-
getRoundedCorners
public boolean getRoundedCorners()返回此边框是否将以圆角绘制。- 返回:
-
如果此边框应具有圆角,则为
true - 自1.3起:
- 1.3
-
isBorderOpaque
public boolean isBorderOpaque()返回边框是否不透明。- 指定者:
-
isBorderOpaque在接口Border中 - 覆盖:
-
isBorderOpaque在类AbstractBorder中 - 返回:
-
如果边框是不透明的,则为
true,否则为false
-