Class UnifiedToolBar

java.lang.Object
com.explodingpixels.macwidgets.UnifiedToolBar

public class UnifiedToolBar extends Object
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:
 UnifiedToolBar toolBar = new UnifiedToolBar();
 JButton button = new JButton("My Button");
 button.putClientProperty("JButton.buttonType", "textured");
 toolBar.addComponentToLeft(button);
 
  • Constructor Details

    • UnifiedToolBar

      public UnifiedToolBar()
      Creates a UnifiedToolBar with balanced ends.
    • UnifiedToolBar

      public UnifiedToolBar(boolean forceSameWidth)
      Creates a UnifiedToolBar.
      Parameters:
      forceSameWidth - whether the two ends should have the same width to keep the center balanced.
  • Method Details

    • addComponentToLeft

      public void addComponentToLeft(JComponent toolToAdd)
      Adds the given component to the left side of this UnifiedToolbar.
      Parameters:
      toolToAdd - the tool to add to this UnifiedToolbar.
    • addComponentToCenter

      public void addComponentToCenter(JComponent toolToAdd)
      Adds the given component to the side of this UnifiedToolbar.
      Parameters:
      toolToAdd - the tool to add to this UnifiedToolbar.
    • addComponentToRight

      public void addComponentToRight(JComponent toolToAdd)
      Adds the given component to the right side of this UnifiedToolBar .
      Parameters:
      toolToAdd - the tool to add to this UnifiedToolBar.
    • installWindowDraggerOnWindow

      public void installWindowDraggerOnWindow(Window window)
      Installs a drag listener on this UnifiedToolBar such that if it is dragged, it will move the given Window.
      Parameters:
      window - the Window to move when the this UnifiedToolbar is dragged.
    • getComponent

      public JComponent getComponent()
      Gets the user interface component representing this UnifiedToolBar. The returned JComponent 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.