java.lang.Objectjavax.swing.border.AbstractBorder
public abstract class AbstractBorder
实现无大小限制的空边框类。它提供了一个便捷的基类,其他边框类可方便地从其派生。
警告:此类的序列化对象将与以后的 Swing 版本不兼容。当前的序列化支持适用于短期存储或运行相同 Swing 版本的应用程序之间的 RMI。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder。
| 构造方法摘要 | |
|---|---|
AbstractBorder() |
|
| 方法摘要 | |
|---|---|
int |
getBaseline(Component c, int width, int height) 返回基线。 |
Component.BaselineResizeBehavior |
getBaselineResizeBehavior(Component c) 返回一个枚举,指示组件的基线如何随大小的改变而发生更改。 |
Insets |
getBorderInsets(Component c) 此默认实现返回一个新的 Insets 实例,其中 top、left、bottom 和 right 字段都设置成了 0。 |
Insets |
getBorderInsets(Component c, Insets insets) 用此边框的当前 Insets 重新初始化 insets 参数。 |
static Rectangle |
getInteriorRectangle(Component c, Border b, int x, int y, int width, int height) 返回一个用所给的参数减去边框 insets 得到的矩形。 |
Rectangle |
getInteriorRectangle(Component c, int x, int y, int width, int height) 此便捷方法调用静态方法。 |
boolean |
isBorderOpaque() 此默认实现返回 false。 |
void |
paintBorder(Component c, Graphics g, int x, int y, int width, int height) 此默认实现不执行绘制操作。 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public AbstractBorder()
| 方法详细信息 |
|---|
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
Border 中的
paintBorder
c - 要为其绘制边框的组件
g - 绘制的图形
x - 所绘制边框的 x 坐标位置
y - 所绘制边框的 y 坐标位置
width - 所绘制边框的宽度
height - 所绘制边框的高度
public Insets getBorderInsets(Component c)
Insets 实例,其中
top、
left、
bottom 和
right 字段都设置成了
0。
Border 中的
getBorderInsets
c - 应用此边框 insets 值的组件
Insets 对象
public Insets getBorderInsets(Component c, Insets insets)
c - 应用此边框 insets 值的组件
insets - 要重新初始化的对象
insets 对象
public boolean isBorderOpaque()
Border 中的
isBorderOpaque
public Rectangle getInteriorRectangle(Component c, int x, int y, int width, int height)
c - 要为其计算此边框的组件
x - 边框的 x 坐标位置
y - 边框的 y 坐标位置
width - 边框的宽度
height - 边框的高度
Rectangle
public static Rectangle getInteriorRectangle(Component c, Border b, int x, int y, int width, int height)
c - 为其计算边框的组件
b -
Border 对象
x - 边框的 x 坐标位置
y - 边框的 y 坐标位置
width - 边框的宽度
height - 边框的高度
Rectangle
public int getBaseline(Component c, int width, int height)
默认实现返回 -1。支持基线的子类应该进行适当地重写。如果返回 >= 0 的值,则任何大小 >= 最小大小的组件都具有有效基线并且 getBaselineResizeBehavior 可用于确定基线如何随大小的改变而发生更改。
c - 将为其请求基线的
Component
width - 为其获取基线的宽度
height - 为其获取基线的高度
IllegalArgumentException - 如果宽度或高度 < 0
Component.getBaseline(int,int),
Component.getBaselineResizeBehavior()
public Component.BaselineResizeBehavior getBaselineResizeBehavior(Component c)
默认实现返回 BaselineResizeBehavior.OTHER,支持基线的子类应该进行适当地重写。子类从不返回 null;如果不能计算基线,则返回 BaselineResizeBehavior.OTHER。调用者应该首先使用 getBaseline 请求基线,如果返回 >= 0 的值,则使用此方法。此方法返回 BaselineResizeBehavior.OTHER 以外的值也是可以接受的,即使 getBaseline 返回小于 0 的值。
c - 为其返回基线调整大小行为的
Component
Component.getBaseline(int,int),
Component.getBaselineResizeBehavior()