The CompoundBorder Class
You can combine two borders to create more eye-catching displays with
the CompoundBorder
class. The insets of both borders are
added together to form the insets of the resulting compound border
object. The component renders the outside border first, followed by
the inside border. You can compound borders recursively so that any
number of borders can be embedded inside of a
CompoundBorder
object:
CompoundBorder comp = new CompoundBorder( new CompoundBorder(new EtchedBorder(), new EmptyBorder(10, 10, 10, 10)), new MatteBorder(20, 20, 20, 20, Color.red) );
The preceding code yields the border in Figure 13.14.
Figure 13-14. A compound border
Properties
Table 13.14 lists the properties of the
CompoundBorder
class. The
insideBorder
and
outsideBorder
properties hold the borders that are
combined. If both of the borders in the compound border are opaque,
the borderOpaque
property is set to
true
. Otherwise, the property is
false
.
Table 13-14. CompoundBorder Properties
Property |
Data Type |
get |
is |
set |
bound |
Default Value |
---|---|---|---|---|---|---|
|
|
• | ||||
|
|
• |
| |||
|
|
• |
|
Constructors
- public CompoundBorder()
Initializes a default compound border with no outside and inside borders. Because there are no “set” accessors for either border property, you probably won’t ever need to invoke this ...
Get Java Swing now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.