- java.lang.Object
-
- javax.swing.border.AbstractBorder
-
- javax.swing.border.StrokeBorder
-
- 实现的所有接口
-
Serializable,Border
public class StrokeBorder extends AbstractBorder
实现任意笔划边框的类。警告:此类的序列化对象与以后的Swing版本不兼容。 当前的序列化支持适用于运行相同版本Swing的应用程序之间的短期存储或RMI。 从1.4开始,
java.beans软件包中添加了对所有JavaBeansjava.beans长期存储的支持。 请参阅XMLEncoder。- 从以下版本开始:
- 1.7
- 另请参见:
- Serialized Form
-
-
构造方法摘要
构造方法 构造器 描述 StrokeBorder(BasicStroke stroke)创建指定的stroke。StrokeBorder(BasicStroke stroke, Paint paint)创建指定的stroke和paint。
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 InsetsgetBorderInsets(Component c, Insets insets)使用此边框的当前插入重新初始化insets参数。PaintgetPaint()返回用于在边框渲染期间生成颜色的Paint对象。BasicStrokegetStroke()返回用于在边框渲染期间描边形状的BasicStroke对象。voidpaintBorder(Component c, Graphics g, int x, int y, int width, int height)使用指定的位置和大小绘制指定组件的边框。-
声明方法的类 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- 应用此border insets值的组件 -
insets- 要重新初始化的Insets对象 - 结果
-
重新初始化的
insets参数 - 异常
-
NullPointerException- 如果指定的insets是null - 另请参见:
-
Math.ceil(double)
-
getStroke
public BasicStroke getStroke()
返回用于在边框渲染期间描边形状的BasicStroke对象。- 结果
-
BasicStroke对象
-
-