Java Reference
In-Depth Information
public static Border createGrayLineBorder()
Border grayLine = LineBorder.createGrayLineBorder();
public static Border createLineBorder(Color color)
Border lineBorder = BorderFactory.createLineBorder(Color.RED);
public static Border createLineBorder(Color color, int thickness)
Border lineBorder = BorderFactory.createLineBorder(Color.RED, 5);
Note The LineBorder factory methods work as follows: If you create the same border twice, the same
LineBorder object will be returned. However, as with all object comparisons, you should always use the
equals() method for checking object equality.
Each allows you to customize the border color and line thickness. If a thickness isn't spec-
ified, a default value of 1 is used. The two factory methods of LineBorder are for the commonly
used colors of black and gray. Because the border fills in the entire insets area, the LineBorder
is opaque, unless there are rounded corners. So, the opacity of the border is the opposite of the
rounded-corner setting.
Configuring Line Border Properties
Table 7-1 lists the inherited borderOpaque property from AbstractBorder and the immutable
properties of LineBorder .
Table 7-1. LineBorder Properties
Property Name
Data Type
Access
borderOpaque
boolean
Read-only
lineColor
Color
Read-only
roundedCorners
boolean
Read-only
thickness
int
Read-only
BevelBorder Class
A bevel border draws a border with a three-dimensional appearance, which can appear to be
raised or lowered. When the border is raised, a shadow effect appears along the bottom and
right side of the border. When lowered, the position of the shading is reversed. Figure 7-5
shows raised and lowered bevel borders with default and custom colors.
 
Search WWH ::




Custom Search