public class ToolBar extends Control
A ToolBar is a control which displays items horizontally
or vertically. The most common items to place within a ToolBar
are Buttons
, ToggleButtons
and
Separators
, but you are not restricted to just these, and
can insert any Node
into them.
If there are too many items to fit in the ToolBar an overflow button will appear. The overflow button allows you to select items that are not currently visible in the toolbar.
ToolBar sets focusTraversable to false.
Example of a horizontal ToolBar with eight buttons separated with two vertical separators.
ToolBar toolBar = new ToolBar(
new Button("New"),
new Button("Open"),
new Button("Save"),
new Separator(true),
new Button("Clean"),
new Button("Compile"),
new Button("Run"),
new Separator(true),
new Button("Debug"),
new Button("Profile")
);
Type | Property and Description |
---|---|
<any> |
orientation
The orientation of the
ToolBar - this can either be horizontal
or vertical. |
contextMenuProperty, skinClassNameProperty, skinProperty, tooltipProperty
Modifier and Type | Class and Description |
---|---|
private static class |
ToolBar.StyleableProperties |
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
DEFAULT_STYLE_CLASS
*
Stylesheet Handling *
*
|
private static PseudoClass |
HORIZONTAL_PSEUDOCLASS_STATE |
private <any> |
items |
private <any> |
orientation
The orientation of the
ToolBar - this can either be horizontal
or vertical. |
private static PseudoClass |
VERTICAL_PSEUDOCLASS_STATE |
Constructor and Description |
---|
ToolBar()
Creates an empty tool bar.
|
ToolBar(Node... items)
Creates a tool bar populated with the specified nodes.
|
Modifier and Type | Method and Description |
---|---|
protected Skin<?> |
createDefaultSkin()
Create a new instance of the default skin for this control.
|
static java.util.List<<any>> |
getClassCssMetaData() |
java.util.List<<any>> |
getControlCssMetaData() |
protected java.lang.Boolean |
getInitialFocusTraversable()
Returns the initial focus traversable state of this control, for use
by the JavaFX CSS engine to correctly set its initial value.
|
<any> |
getItems()
The items contained in the
ToolBar . |
Orientation |
getOrientation()
Gets the value of the property orientation.
|
private void |
initialize() |
<any> |
orientationProperty()
The orientation of the
ToolBar - this can either be horizontal
or vertical. |
void |
setOrientation(Orientation value)
Sets the value of the property orientation.
|
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getContextMenu, getControlChildren, getCssMetaData, getSkin, getTooltip, isResizable, layoutChildren, loadSkinClass, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinClassNameProperty, skinProperty, tooltipProperty
public final <any> orientationProperty
ToolBar
- this can either be horizontal
or vertical.getOrientation()
,
setOrientation(Orientation)
private final <any> items
private <any> orientation
ToolBar
- this can either be horizontal
or vertical.private static final java.lang.String DEFAULT_STYLE_CLASS
private static final PseudoClass VERTICAL_PSEUDOCLASS_STATE
private static final PseudoClass HORIZONTAL_PSEUDOCLASS_STATE
public ToolBar()
public ToolBar(Node... items)
items
- the items to addprivate void initialize()
public final <any> getItems()
ToolBar
. Typical use case for a
ToolBar
suggest that the most common items to place within it
are Buttons
, ToggleButtons
, and Separators
,
but you are not restricted to just these, and can insert any Node
.
The items added must not be null.public final void setOrientation(Orientation value)
public final Orientation getOrientation()
public final <any> orientationProperty()
ToolBar
- this can either be horizontal
or vertical.getOrientation()
,
setOrientation(Orientation)
protected Skin<?> createDefaultSkin()
-fx-skin
or set explicitly in a sub-class with setSkin(...)
.createDefaultSkin
in class Control
public static java.util.List<<any>> getClassCssMetaData()
public java.util.List<<any>> getControlCssMetaData()
getControlCssMetaData
in class Control
protected java.lang.Boolean getInitialFocusTraversable()
getInitialFocusTraversable
in class Control