- java.lang.Object
-
- javax.swing.border.AbstractBorder
-
- javax.swing.border.StrokeBorder
-
- All Implemented Interfaces:
-
Serializable,Border
public class StrokeBorder extends AbstractBorder
实现任意笔画边框的课程。警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,所有JavaBeans的长期存储支持已被添加到
java.beans包中。 请参阅XMLEncoder。- 从以下版本开始:
- 1.7
- 另请参见:
- Serialized Form
-
-
构造方法摘要
构造方法 Constructor 描述 StrokeBorder(BasicStroke stroke)创建指定的边框stroke。StrokeBorder(BasicStroke stroke, Paint paint)创建指定的stroke和paint。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 InsetsgetBorderInsets(Component c, Insets insets)使用此边框的当前插图重新初始化insets参数。PaintgetPaint()返回在边框渲染期间用于生成颜色的Paint对象。BasicStrokegetStroke()返回在边框渲染期间用于描边形状的BasicStroke对象。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, isBorderOpaque
-
-
-
-
构造方法详细信息
-
StrokeBorder
public StrokeBorder(BasicStroke stroke)
创建指定的边框stroke。 组件的前景颜色将用于渲染边框。- 参数
-
stroke- 用于描边形状的BasicStroke对象 - 异常
-
NullPointerException- 如果指定的stroke是null
-
StrokeBorder
@ConstructorProperties({"stroke","paint"}) public StrokeBorder(BasicStroke stroke, Paint paint)
创建指定的stroke和paint。 如果指定的paint是null,组件的前景颜色将用于渲染边框。- 参数
-
stroke- 用于描边形状的BasicStroke对象 -
paint- 用于生成颜色的Paint对象 - 异常
-
NullPointerException- 如果指定的stroke是null
-
-
方法详细信息
-
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- 绘画边框的高度 - 异常
-
NullPointerException- 如果指定的g是null
-
getBorderInsets
public Insets getBorderInsets(Component c, Insets insets)
使用此边框的当前插图重新初始化insets参数。 每个插入是最大(最接近负无穷大)的整数值,大于或等于用于绘制边框的笔画线宽。- 重写:
-
getBorderInsets在AbstractBorder - 参数
-
c- 应用此边界插入值的组件 -
insets- 要重新初始化的Insets对象 - 结果
-
重新初始化的
insets参数 - 异常
-
NullPointerException- 如果指定的insets是null - 另请参见:
-
Math.ceil(double)
-
getStroke
public BasicStroke getStroke()
返回用于在边框呈现期间描边形状的BasicStroke对象。- 结果
-
BasicStroke对象
-
-