Java Reference
In-Depth Information
The rollover property defines a behavior specific to the look and feel for when the user
moves the mouse over the different components within the toolbar. This behavior could
involve coloration or border differences.
Handling JToolBar Events
There are no events specific to the JToolBar . You need to attach listeners to each item on the
JToolBar that you want to respond to user interaction. Of course, JToolBar is a Container , so
you could listen to its events.
Customizing a JToolBar Look and Feel
Each installable Swing look and feel provides its own JToolBar appearance and set of default
UIResource values. Most of this appearance is controlled by the components actually within
the toolbar. Figure 6-11 shows the appearance of the JToolBar component for the preinstalled
set of look and feel types: Motif, Windows, and Ocean. Each toolbar has five JButton compo-
nents, with a separator between the fourth and fifth.
Motif
Windows
Ocean
Figure 6-11. JToolBar under different look and feel types
The available set of UIResource -related properties for a JToolBar is shown in Table 6-16.
For the JToolBar component, there are 22 different properties.
Table 6-16. JToolBar UIResource Elements
Property String
Object Type
ToolBar.actionMap
ActionMap
ToolBar.ancestorInputMap
InputMap
ToolBar.background
Color
Search WWH ::




Custom Search