ToolBar
A strip of items - buttons, toggles, separators - the user reaches without opening a menu, held by a JToolBar. The bar holds whether it stands docked or in a window of its own, and reports the drags that move it between the two.
The items declared in content become the tool bar's children in declaration order:
ToolBar {
Button(text = "New", onClick = { ... })
ToolBarSeparator()
Button(text = "Open", onClick = { ... })
}A Glue among the items pushes the ones after it to the trailing end, which is how a tool bar gets a trailing group.
A floatable bar can be dragged out into a window of its own. floating is a two-way state: it puts the bar into its own window or brings it back, and onFloatingChange reports the state the user drags the bar into or docks it back to. Floating needs a window to open the bar's own beside, and a bar whose look and feel gives it no dragging, whose floatable is false, or that is not in a window yet has none to open. Where the bar cannot take the declaration it stays docked, and onFloatingChange is handed that answer; a bar that comes to stand in a window later takes the standing declaration then. A drag the caller does not answer with a matching floating is settled back, so the bar returns to the state the composition declares.
A bar docked back from its window, or dropped onto another edge of its container, returns to the region its modifier declares, but not to its place among the container's other children: the look and feel's dock adds the bar at the end of them, and it stays there, in z-order and in focus traversal order. A look and feel turns a bar it docks on a side edge to face along that edge, and it is turned back to the orientation declared.
A floating bar is held by that window instead of the container it was declared in, and its items keep composing there. The composition still counts the bar among the children of the container it left, so declare a floating bar's siblings - and the bar itself - while it is docked. A bar that leaves the composition while floating takes its window with it.
Parameters
the SwingModifier applied to the underlying JToolBar
the axis along which items are laid out (an Orientation SwingConstants value); the default HORIZONTAL lays them out along the bar's reading order
whether the user can drag the tool bar out into a window of its own, and, while it is docked, to another edge of the container holding it, or null to leave the choice the bar already carries, which a bar carries as draggable; a look and feel that implements no floating ignores it. A bar the user can drag out has to stand in a container laid out by a BorderLayout - a BorderPanel, or a window's own content - which is the only place a look and feel docks it back into the region it came from; anywhere else the bar is refused as it is composed, so declare false there
whether the tool bar stands in a window of its own rather than in the container it was declared in (controlled); false by default, so the bar starts docked where it was declared
callback invoked with the state the user drags the bar into, or with the docked state the bar settles for when it cannot take floating
whether the look and feel draws an item's border only while the pointer is over it, or null to leave the choice to it; a choice withdrawn after being declared settles at its answer for good, and a look and feel may ignore the request
the items hosted by the tool bar; empty by default