Package com.explodingpixels.macwidgets
Class SourceListControlBar
- java.lang.Object
-
- com.explodingpixels.macwidgets.SourceListControlBar
-
public class SourceListControlBar extends java.lang.ObjectA bar that can contain buttons and pop-down buttons that act on a given
SourceList. This control bar is displayed at the base of theSourceList. The control bar also has a draggable widget that can control the divider location of a givenJSplitPane.Heres how to create and install an empty
SourceListControlBar:SourceList sourceList = DSourceListITunes.createSourceList(); SourceListControlBar controlBar = new SourceListControlBar(); sourceList.installSourceListControlBar(controlBar);
The above code creates a control bar that looks like this:
The following code adds two push buttons and a drop-down button to the control bar:
controlBar.createAndAddPopdownButton(MacIcons.GEAR, new PopupMenuCustomizer() { public void customizePopup(JPopupMenu popup) { popup.removeAll(); popup.add(new JMenuItem("Item One")); popup.add(new JMenuItem("Item Two")); popup.add(new JMenuItem("Item Three")); } });The above code creates a control bar that looks like this:
-
-
Constructor Summary
Constructors Constructor Description SourceListControlBar()Creates aSourceListControlBar.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateAndAddButton(javax.swing.Icon icon, java.awt.event.ActionListener actionListener)Adds a new button with the given icon.voidcreateAndAddPopdownButton(javax.swing.Icon icon, PopupMenuCustomizer popupMenuCustomizer)Add a new pop-down style button.javax.swing.JComponentgetComponent()Gets the user interface component representing thisSourceListControlBar.voidhideResizeHandle()Hides the resize handle.voidinstallDraggableWidgetOnSplitPane(javax.swing.JSplitPane splitPane)Connects the draggable widget in thisSourceListControlBarto the divider of the givenJSplitPane.
-
-
-
Method Detail
-
installDraggableWidgetOnSplitPane
public void installDraggableWidgetOnSplitPane(javax.swing.JSplitPane splitPane)
Connects the draggable widget in thisSourceListControlBarto the divider of the givenJSplitPane. Thus when the user drags theSourceListControlBardraggable widget, the givenJSplitPanes divider location will be adjusted.- Parameters:
splitPane- theJSplitPaneto connect the draggable widget to.
-
getComponent
public javax.swing.JComponent getComponent()
Gets the user interface component representing thisSourceListControlBar. The returnedJComponentshould be added to a container that will be displayed.- Returns:
- the user interface component representing this
SourceListControlBar.
-
createAndAddPopdownButton
public void createAndAddPopdownButton(javax.swing.Icon icon, PopupMenuCustomizer popupMenuCustomizer)Add a new pop-down style button. The givenPopupMenuCustomizerwill be called just prior to each showing of the menu.- Parameters:
icon- the icon to use in the pop-down menu.popupMenuCustomizer- thePopupMenuCustomizerto be called just prior to showing the menu.
-
createAndAddButton
public void createAndAddButton(javax.swing.Icon icon, java.awt.event.ActionListener actionListener)Adds a new button with the given icon. The givenActionListenerwill be called when the button is pressed.- Parameters:
icon- the icon to use for the button.actionListener- theActionListenerto call when the button is pressed.
-
hideResizeHandle
public void hideResizeHandle()
Hides the resize handle.
-
-