To set lowered bezels in a JLabel
, you can use the setBorder
method and pass it an instance of BevelBorder
.
Here is an example of how to set lowered bezels in a JLabel
:
JLabel label = new JLabel("Label with lowered bezels"); label.setBorder(new BevelBorder(BevelBorder.LOWERED));
The BevelBorder
class is a type of border that consists of a raised or lowered edge. You can specify the type of bevel by passing one of the constants BevelBorder.RAISED
or BevelBorder.LOWERED
to the constructor.
You can also customize the appearance of the bevel border by using one of the other constructors of BevelBorder
that allow you to specify the highlight and shadow colors, as well as the type of bevel (raised or lowered).
For example, the following code creates a BevelBorder
with a lowered edge, using custom highlight and shadow colors:
BevelBorder border = new BevelBorder(BevelBorder.LOWERED, Color.YELLOW, Color.BLUE, Color.GRAY, Color.GREEN); label.setBorder(border);
You can also use other types of borders, such as EtchedBorder
, LineBorder
, or TitledBorder
, to achieve different effects.