Java Reference
In-Depth Information
Figure 7-5.
Raised and lowered BevelBorder sample
Drawing two different pairs of 1-pixel-wide lines around the component produces a simu-
lated three-dimensional appearance. The border sides that aren't shaded are drawn with what
is called a
highlight
color, and the other two sides are drawn with a
shadow
color. The highlight
color and shadow color are each drawn in two different shades for the outer and inner edges of
the bevel. As such, a drawn bevel border uses four different colors in all. Figure 7-6 shows how
these four colors fit together.
Figure 7-6.
Bevel color analysis
There are three constructors and one factory method of
BevelBorder
, as well as five factory
methods by which
BorderFactory
creates
BevelBorder
objects:
public BevelBorder(int bevelType)
Border bevelBorder = new BevelBorder(BevelBorder.RAISED);
public static Border createBevelBorder(int bevelType)
Border bevelBorder = BorderFactory.createBevelBorder(BevelBorder.RAISED);
public static Border createLoweredBevelBorder()
Border bevelBorder = BorderFactory.createLoweredBevelBorder();