
Then the action listener can use this string to distinguish among the various menu
items. But what if the action listener needs to check some kind of object other
than a
String in order to decide how to process the action event? Client properties
ar e the solution: they allow you to associate an arbitrary object (or multiple
objects) with each
JMenuItem.
Client properties are used within Swing to set properties that are specific to a sin-
gle look-and-feel implementation. For example, the default Java look-and-feel
examines the client properties of a few components to obtain additional informa-
tion about how it should display the components. Here are some details on these
particular client properties:
"JInternalFrame.isPalette"
When a JInternalFrame is being used as a floating palette, set this client
pr operty to
Boolean.TRUE to change the look of the border.
"JScrollBar.isFreeStanding"
JScrollPane sets this client property to Boolean.FALSE on the JScrollBar
components it creates.
"JSlider.isFilled"
Setting this client property of a JSlider to Boolean.TRUE causes the slider to
display a differ ent backgr ound color on either side of the slider thumb.
"JToolBar.isRollover"
Setting this client property to Boolean.TRUE on a JToolBar causes the compo-
nent to highlight the border of whatever child component the mouse is cur-
rently over.
"JTree.lineStyle"
This client property specifies how the JTree component ...