java.lang.Objectjavax.swing.border.AbstractBorder
javax.swing.border.EtchedBorder
public class EtchedBorder
该类实现简单的浮雕化边框,它既可以是阴刻浮雕化边框,也可以是阳刻浮雕化边框。如果创建边框时未初始化任何高亮显示/阴影颜色,则这些颜色将从传递给 paintBorder() 方法的组件参数的背景色动态派生。
警告:此类的已序列化对象与以后的 Swing 版本不兼容。当前序列化支持适用于短期存储,或适用于在运行相同 Swing 版本的应用程序之间进行 RMI(Remote Method Invocation,远程方法调用)。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder。
| 字段摘要 | |
|---|---|
protected int |
etchType |
protected Color |
highlight |
static int |
LOWERED 阴刻浮雕化类型。 |
static int |
RAISED 阳刻浮雕化类型。 |
protected Color |
shadow |
| 构造方法摘要 | |
|---|---|
EtchedBorder() 创建一个阴刻浮雕化类型的边框,其颜色将从传递给 paintBorder 方法的组件的背景色派生。 |
|
EtchedBorder(Color highlight, Color shadow) 创建具有指定高亮显示和阴影颜色的阴刻浮雕化边框 |
|
EtchedBorder(int etchType) 创建具有指定蚀刻类型的浮雕化边框,其颜色将从传递给 paintBorder 方法的组件的背景色派生 |
|
EtchedBorder(int etchType, Color highlight, Color shadow) 创建具有指定蚀刻类型、高亮显示和阴影颜色的浮雕化边框 |
|
| 方法摘要 | |
|---|---|
Insets |
getBorderInsets(Component c) 返回边框的 insets |
Insets |
getBorderInsets(Component c, Insets insets) 用此边框的当前 Insets 重新初始化 insets 参数 |
int |
getEtchType() 返回浮雕化边框设置的蚀刻类型。 |
Color |
getHighlightColor() 返回浮雕化边框的高亮显示颜色。 |
Color |
getHighlightColor(Component c) 返回浮雕化边框在指定组件上呈现的高亮显示颜色。 |
Color |
getShadowColor() 返回浮雕化边框的阴影颜色。 |
Color |
getShadowColor(Component c) 返回浮雕化边框在指定组件上呈现的阴影颜色。 |
boolean |
isBorderOpaque() 返回边框是否透明。 |
void |
paintBorder(Component c, Graphics g, int x, int y, int width, int height) 按照指定的位置和尺寸为指定的组件绘制边框 |
| 从类 javax.swing.border.AbstractBorder 继承的方法 |
|---|
getBaseline, getBaselineResizeBehavior, getInteriorRectangle, getInteriorRectangle |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
public static final int RAISED
public static final int LOWERED
protected int etchType
protected Color highlight
protected Color shadow
| 构造方法详细信息 |
|---|
public EtchedBorder()
public EtchedBorder(int etchType)
etchType - 边框要绘制的蚀刻类型
public EtchedBorder(Color highlight, Color shadow)
highlight - 用于浮雕化高亮显示的颜色
shadow - 用于浮雕化阴影的颜色
public EtchedBorder(int etchType,
Color highlight,
Color shadow)
etchType - 边框要绘制的蚀刻类型
highlight - 用于浮雕化高亮显示的颜色
shadow - 用于浮雕化阴影的颜色
| 方法详细信息 |
|---|
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
Border 中的
paintBorder
AbstractBorder 中的
paintBorder
c - 要为其绘制边框的组件
g - 绘制的图形
x - 所绘制边框的 x 坐标位置
y - 所绘制边框的 y 坐标位置
width - 所绘制边框的宽度
height - 所绘制边框的高度
public Insets getBorderInsets(Component c)
Border 中的
getBorderInsets
AbstractBorder 中的
getBorderInsets
c - 要应用此边框 insets 值的组件
Insets 对象
public Insets getBorderInsets(Component c, Insets insets)
AbstractBorder 中的
getBorderInsets
c - 应用此边框 insets 值的组件
insets - 要重新初始化的对象
insets 对象
public boolean isBorderOpaque()
Border 中的
isBorderOpaque
AbstractBorder 中的
isBorderOpaque
public int getEtchType()
public Color getHighlightColor(Component c)
c - 从其派生高亮显示颜色的组件
public Color getHighlightColor()
public Color getShadowColor(Component c)
c - 从其派生阴影颜色的组件
public Color getShadowColor()