Java Reference
In-Depth Information
■
Caution
If the orientation property isn't set to a value equivalent to either
JSeparator.HORIZONTAL
or
JSeparator.VERTICAL
, an
IllegalArgumentException
is thrown.
Customizing a JSeparator Look and Feel
The appearance of the
JSeparator
under the preinstalled set of look and feel types is shown
with the other menu components in Figure 6-3.
The available set of
UIResource
-related properties for a
JSeparator
is shown in Table 6-8.
For the
JSeparator
component, five different properties are available.
Table 6-8.
JSeparator UIResource Elements
Property String
Object Type
Separator.background
Color
Separator.foreground
Color
Separator.insets
Insets
Separator.thickness
Integer
SeparatorUI
String
■
Caution
Two additional properties,
highlight
and
shadow
, are present but deprecated and should not
be used.
JPopupMenu Class
The
JPopupMenu
component is the container for pop-up menu components, displayable anywhere
and used for support by
JMenu
. When a programmer-defined triggering event happens, you
display the
JPopupMenu
, and the menu displays the contained menu components. Like
JMenuBar
,
JPopupMenu
uses the
SingleSelectionModel
to manage the currently selected element.
Creating JPopupMenu Components
There are two constructors for
JPopupMenu
:
public JPopupMenu()
JPopupMenu jPopupMenu = new JPopupMenu();
public JPopupMenu(String title)
JPopupMenu jPopupMenu = new JPopupMenu("Welcome");