Package com.explodingpixels.macwidgets
Class UnifiedToolBar
java.lang.Object
com.explodingpixels.macwidgets.UnifiedToolBar
A Mac style Unified Tool Bar. For a full description of what a Unified Tool
Bar is, see the Toolbars section of Apple's Human Interface Guidelines. Here's an
example of the what this method creates:
Here's a simple example that creates a Unified Tool Bar with a single button:

Here's a simple example that creates a Unified Tool Bar with a single button:
UnifiedToolBar toolBar = new UnifiedToolBar(); JButton button = new JButton("My Button"); button.putClientProperty("JButton.buttonType", "textured"); toolBar.addComponentToLeft(button);
-
Constructor Summary
ConstructorsConstructorDescriptionCreates aUnifiedToolBar
with balanced ends.UnifiedToolBar
(boolean forceSameWidth) Creates aUnifiedToolBar
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComponentToCenter
(JComponent toolToAdd) Adds the given component to the side of thisUnifiedToolbar
.void
addComponentToLeft
(JComponent toolToAdd) Adds the given component to the left side of thisUnifiedToolbar
.void
addComponentToRight
(JComponent toolToAdd) Adds the given component to the right side of thisUnifiedToolBar
.void
Disables any custom background painter that may be installed.Gets the user interface component representing thisUnifiedToolBar
.void
installWindowDraggerOnWindow
(Window window) Installs a drag listener on thisUnifiedToolBar
such that if it is dragged, it will move the givenWindow
.
-
Constructor Details
-
UnifiedToolBar
public UnifiedToolBar()Creates aUnifiedToolBar
with balanced ends. -
UnifiedToolBar
public UnifiedToolBar(boolean forceSameWidth) Creates aUnifiedToolBar
.- Parameters:
forceSameWidth
- whether the two ends should have the same width to keep the center balanced.
-
-
Method Details
-
addComponentToLeft
Adds the given component to the left side of thisUnifiedToolbar
.- Parameters:
toolToAdd
- the tool to add to thisUnifiedToolbar
.
-
addComponentToCenter
Adds the given component to the side of thisUnifiedToolbar
.- Parameters:
toolToAdd
- the tool to add to thisUnifiedToolbar
.
-
addComponentToRight
Adds the given component to the right side of thisUnifiedToolBar
.- Parameters:
toolToAdd
- the tool to add to thisUnifiedToolBar
.
-
installWindowDraggerOnWindow
Installs a drag listener on thisUnifiedToolBar
such that if it is dragged, it will move the givenWindow
.- Parameters:
window
- theWindow
to move when the thisUnifiedToolbar
is dragged.
-
getComponent
Gets the user interface component representing thisUnifiedToolBar
. The returnedJComponent
should be added to a container that will be displayed.- Returns:
- the user interface component representing this
UnifiedToolBar
.
-
disableBackgroundPainter
public void disableBackgroundPainter()Disables any custom background painter that may be installed.
-