JToolBar
provides a component that is useful for
displaying commonly used Action
s or controls.
JToolBar will change buttons's isOpaque() method, so if your programe's logic is related to button's opaque, take care to add buttons to JToolBar.
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".
new JToolBar()
public function JToolBar(title:String, orientation:Number)
JToolBar(title:String, orientation:Number)
JToolBar(title:String)
default orientation to HORIZONTAL
JToolBar()
default title to null, orientation to HORIZONTAL
Creates a new tool bar with a specified title
and
orientation
.
title is only shown when the tool bar is undocked.
title | the title of the tool bar |
orientation | orientation the initial orientation -- it must be
either HORIZONTAL or VERTICAL
|
public function updateUI():Void
Description copied from Component
Resets the UI property to a value from the current look and feel.
Component
subclasses must override this method
like this:
public void updateUI() { setUI((SliderUI)UIManager.getUI(this); }
public function setUI(newUI:ToolBarUI):Void
Description copied from Component
Sets the look and feel delegate for this component.
Component
subclasses generally override this method
to narrow the argument type. For example, in JSlider
:
public void setUI(SliderUI newUI) { super.setUI(newUI); }
Additionally Component
subclasses must provide a
getUI
method that returns the correct type. For example:
public SliderUI getUI() { return (SliderUI)ui; }
public function getUIClassID():String
Description copied from Component
Returns the UIDefaults
key used to
look up the name of the org.aswing.plaf.ComponentUI
class that defines the look and feel
for this component. Most applications will never need to
call this method. Subclasses of Component
that support
pluggable look and feel should override this method to
return a UIDefaults
key that maps to the
ComponentUI
subclass that defines their look and feel.
public function setMargin(m:Insets):Void
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).
m | an Insets object that defines the space
between the border and the buttons
|
public function getMargin():Insets
Returns the margin between the tool bar's border and its buttons.
an Insets
object containing the margin values
public function setFloatable(b:Boolean):Void
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.
b | if true , the tool bar can be moved;
false otherwise
|
public function getOrientation():Number
Returns the current orientation of the tool bar. The value is either
HORIZONTAL
or VERTICAL
.
an integer representing the current orientation -- either
HORIZONTAL
or VERTICAL