Package com.explodingpixels.macwidgets
Class MacButtonFactory
- java.lang.Object
-
- com.explodingpixels.macwidgets.MacButtonFactory
-
public class MacButtonFactory extends java.lang.Object
A factory for creating Mac-style buttons.
-
-
Constructor Summary
Constructors Constructor Description MacButtonFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.swing.JComponent
createGradientButton(java.lang.String text, java.awt.event.ActionListener actionListener)
Creates an Apple style gradient button using the given text.static javax.swing.JComponent
createGradientButton(javax.swing.Icon icon, java.awt.event.ActionListener actionListener)
Creates an Apple style gradient button using the givenIcon
.static PopdownButton
createGradientPopdownButton(javax.swing.Icon icon, PopupMenuCustomizer popupMenuCustomizer)
Creates an Apple style gradient pop-down button using the givenIcon
.static MacWidgetsPainter<java.awt.Component>
getGradientButtonPainter()
Returns aMacWidgetsPainter
that paints a gradient matching Apple's depiction of a "Gradient style" button, depicted here.static javax.swing.AbstractButton
makePreferencesTabBarButton(javax.swing.AbstractButton button)
static javax.swing.AbstractButton
makeUnifiedToolBarButton(javax.swing.AbstractButton button)
-
-
-
Method Detail
-
makeUnifiedToolBarButton
public static javax.swing.AbstractButton makeUnifiedToolBarButton(javax.swing.AbstractButton button)
-
makePreferencesTabBarButton
public static javax.swing.AbstractButton makePreferencesTabBarButton(javax.swing.AbstractButton button)
-
getGradientButtonPainter
public static MacWidgetsPainter<java.awt.Component> getGradientButtonPainter()
Returns aMacWidgetsPainter
that paints a gradient matching Apple's depiction of a "Gradient style" button, depicted here.- Returns:
- a
Painter
that paints an Apple style gradient-button background.
-
createGradientButton
public static javax.swing.JComponent createGradientButton(javax.swing.Icon icon, java.awt.event.ActionListener actionListener)
Creates an Apple style gradient button using the givenIcon
. The givenActionListener
will be notified when the button's action fires.- Parameters:
icon
- theIcon
to use in the button.actionListener
- theActionListener
to notify when the created button is pressed.- Returns:
- a gradient-style button.
-
createGradientButton
public static javax.swing.JComponent createGradientButton(java.lang.String text, java.awt.event.ActionListener actionListener)
Creates an Apple style gradient button using the given text. The givenActionListener
will be notified when the button's action fires.- Parameters:
text
- the text to use in the button.actionListener
- theActionListener
to notify when the created button is pressed.- Returns:
- a gradient-style button.
-
createGradientPopdownButton
public static PopdownButton createGradientPopdownButton(javax.swing.Icon icon, PopupMenuCustomizer popupMenuCustomizer)
Creates an Apple style gradient pop-down button using the givenIcon
. The givenPopupMenuCustomizer
will be notified just prior to the pop-down menu being shown, and can thus add appropriate menu items.- Parameters:
icon
- theIcon
to use in the button.popupMenuCustomizer
- thePopupMenuCustomizer
to be notified just prior to the popup menu being shown.- Returns:
- a gradient-style pop-down menu.
-
-