JToolBar provides a component that is useful for
displaying commonly used Actions or controls.
For examples and information on using tool bars see
How to Use Tool Bars,
a section in The Java Tutorial.

With most look and feels,
the user can drag out a tool bar into a separate window
(unless the floatable property is set to false).
For drag-out to work correctly, it is recommended that you add
JToolBar instances to one of the four "sides" of a
container whose layout manager is a BorderLayout,
and do not add children to any of the other four "sides".

For the keyboard keys used by this component in the standard Look and
Feel (L&F) renditions, see the
JToolBar key assignments.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans package.
Please see XMLEncoder.

createActionChangeListener(JButton b)
Returns a properly configured PropertyChangeListener
which updates the control as changes to the Action occur,
or null if the default
property change listener for the control is desired.

setMargin

Sets the margin between the tool bar's border and
its buttons. Setting to null causes the tool bar to
use the default margins. The tool bar's default Border
object uses this value to create the proper margin.
However, if a non-default border is set on the tool bar,
it is that Border object's responsibility to create the
appropriate margin space (otherwise this property will
effectively be ignored).

Parameters:

m - an Insets object that defines the space
between the border and the buttons

isBorderPainted

setBorderPainted

public void setBorderPainted(boolean b)

Sets the borderPainted property, which is
true if the border should be painted.
The default value for this property is true.
Some look and feels might not implement painted borders;
they will ignore this property.

isFloatable

setFloatable

public void setFloatable(boolean b)

Sets the floatable property,
which must be true for the user to move the tool bar.
Typically, a floatable tool bar can be
dragged into a different position within the same container
or out into its own window.
The default value of this property is true.
Some look and feels might not implement floatable tool bars;
they will ignore this property.

setRollover

public void setRollover(boolean rollover)

Sets the rollover state of this toolbar. If the rollover state is true
then the border of the toolbar buttons will be drawn only when the
mouse pointer hovers over them. The default value of this property
is false.

The implementation of a look and feel may choose to ignore this
property.

add

As of 1.3, this is no longer the preferred method for adding
Actions to a container. Instead it is recommended
to configure a control with an action using
using setAction, and then add that control directly
to the Container.

Parameters:

a - the Action object to add as a new menu item

Returns:

the new button which dispatches the action

createActionComponent

Factory method which creates the JButton for
Actions added to the JToolBar.
The default name is empty if a null action is passed.

As of 1.3, this is no longer the preferred method for adding
Actions to a Container.
Instead it is recommended to configure a control with an action
using setAction, and then add that control directly
to the Container.

createActionChangeListener

Returns a properly configured PropertyChangeListener
which updates the control as changes to the Action occur,
or null if the default
property change listener for the control is desired.

As of 1.3, this is no longer the preferred method for adding
Actions to a Container.
Instead it is recommended to configure a control with an action
using setAction, and then add that control directly
to the Container.

paramString

Returns a string representation of this JToolBar.
This method
is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not
be null.