Package com.formdev.flatlaf.ui
Class FlatButtonUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ButtonUI
-
- javax.swing.plaf.basic.BasicButtonUI
-
- com.formdev.flatlaf.ui.FlatButtonUI
-
- All Implemented Interfaces:
FlatStylingSupport.StyleableUI
- Direct Known Subclasses:
FlatToggleButtonUI
public class FlatButtonUI extends BasicButtonUI implements FlatStylingSupport.StyleableUI
Provides the Flat LaF UI delegate forJButton
.- UiDefault:
- Button.font Font, Button.background Color, Button.foreground Color, Button.border Border, Button.margin Insets, Button.rollover boolean , Button.minimumWidth int, Button.iconTextGap int, Button.startBackground Color optional; if set, a gradient paint is used and Button.background is ignored, Button.endBackground Color optional; if set, a gradient paint is used, Button.focusedBackground Color optional, Button.focusedForeground Color optional, Button.hoverBackground Color optional, Button.hoverForeground Color optional, Button.pressedBackground Color optional, Button.pressedForeground Color optional, Button.selectedBackground Color, Button.selectedForeground Color, Button.disabledBackground Color optional, Button.disabledText Color, Button.disabledSelectedBackground Color, Button.disabledSelectedForeground Color optional, Button.default.background Color, Button.default.startBackground Color optional; if set, a gradient paint is used and Button.default.background is ignored, Button.default.endBackground Color optional; if set, a gradient paint is used, Button.default.foreground Color, Button.default.focusedBackground Color optional, Button.default.focusedForeground Color optional, Button.default.hoverBackground Color optional, Button.default.hoverForeground Color optional, Button.default.pressedBackground Color optional, Button.default.pressedForeground Color optional, Button.default.boldText boolean, Button.paintShadow boolean default is false, Button.shadowWidth int default is 2, Button.shadowColor Color optional, Button.default.shadowColor Color optional, Button.toolbar.spacingInsets Insets, Button.toolbar.hoverBackground Color, Button.toolbar.hoverForeground Color optional, Button.toolbar.pressedBackground Color, Button.toolbar.pressedForeground Color optional, Button.toolbar.selectedBackground Color, Button.toolbar.selectedForeground Color optional, Button.toolbar.disabledSelectedBackground Color optional, Button.toolbar.disabledSelectedForeground Color optional
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
FlatButtonUI.FlatButtonListener
-
Field Summary
-
Fields inherited from class javax.swing.plaf.basic.BasicButtonUI
defaultTextIconGap, defaultTextShiftOffset
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FlatButtonUI(boolean shared)
-
Method Summary
-
Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, getBaseline, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPropertyPrefix, getTextShiftOffset, installKeyboardActions, installListeners, paintButtonPressed, paintFocus, paintText, setTextShiftOffset, uninstallKeyboardActions, uninstallListeners, uninstallUI
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount
-
-
-
-
Field Detail
-
minimumWidth
protected int minimumWidth
-
iconTextGap
protected int iconTextGap
-
background
protected Color background
-
foreground
protected Color foreground
-
startBackground
protected Color startBackground
-
endBackground
protected Color endBackground
-
focusedBackground
protected Color focusedBackground
-
focusedForeground
protected Color focusedForeground
- Since:
- 2.3
-
hoverBackground
protected Color hoverBackground
-
hoverForeground
protected Color hoverForeground
- Since:
- 2.3
-
pressedBackground
protected Color pressedBackground
-
pressedForeground
protected Color pressedForeground
- Since:
- 2.3
-
selectedBackground
protected Color selectedBackground
-
selectedForeground
protected Color selectedForeground
-
disabledBackground
protected Color disabledBackground
-
disabledText
protected Color disabledText
-
disabledSelectedBackground
protected Color disabledSelectedBackground
-
disabledSelectedForeground
protected Color disabledSelectedForeground
- Since:
- 2.3
-
defaultBackground
protected Color defaultBackground
-
defaultEndBackground
protected Color defaultEndBackground
-
defaultForeground
protected Color defaultForeground
-
defaultFocusedBackground
protected Color defaultFocusedBackground
-
defaultFocusedForeground
protected Color defaultFocusedForeground
- Since:
- 2.3
-
defaultHoverBackground
protected Color defaultHoverBackground
-
defaultHoverForeground
protected Color defaultHoverForeground
- Since:
- 2.3
-
defaultPressedBackground
protected Color defaultPressedBackground
-
defaultPressedForeground
protected Color defaultPressedForeground
- Since:
- 2.3
-
defaultBoldText
protected boolean defaultBoldText
-
paintShadow
protected boolean paintShadow
-
shadowWidth
protected int shadowWidth
-
shadowColor
protected Color shadowColor
-
defaultShadowColor
protected Color defaultShadowColor
-
toolbarHoverBackground
protected Color toolbarHoverBackground
-
toolbarHoverForeground
protected Color toolbarHoverForeground
- Since:
- 2.3
-
toolbarPressedBackground
protected Color toolbarPressedBackground
-
toolbarPressedForeground
protected Color toolbarPressedForeground
- Since:
- 2.3
-
toolbarSelectedBackground
protected Color toolbarSelectedBackground
-
toolbarSelectedForeground
protected Color toolbarSelectedForeground
- Since:
- 2.3
-
toolbarDisabledSelectedBackground
protected Color toolbarDisabledSelectedBackground
- Since:
- 2.3
-
toolbarDisabledSelectedForeground
protected Color toolbarDisabledSelectedForeground
- Since:
- 2.3
-
buttonType
protected String buttonType
- Since:
- 2
-
squareSize
protected boolean squareSize
- Since:
- 2
-
minimumHeight
protected int minimumHeight
- Since:
- 2
-
-
Method Detail
-
createUI
public static ComponentUI createUI(JComponent c)
-
installUI
public void installUI(JComponent c)
- Overrides:
installUI
in classBasicButtonUI
-
installDefaults
protected void installDefaults(AbstractButton b)
- Overrides:
installDefaults
in classBasicButtonUI
-
uninstallDefaults
protected void uninstallDefaults(AbstractButton b)
- Overrides:
uninstallDefaults
in classBasicButtonUI
-
createButtonListener
protected BasicButtonListener createButtonListener(AbstractButton b)
- Overrides:
createButtonListener
in classBasicButtonUI
-
propertyChange
protected void propertyChange(AbstractButton b, PropertyChangeEvent e)
-
installStyle
protected void installStyle(AbstractButton b)
- Since:
- 2
-
applyStyle
protected void applyStyle(AbstractButton b, Object style)
- Since:
- 2
-
applyStyleProperty
protected Object applyStyleProperty(AbstractButton b, String key, Object value)
- Since:
- 2
-
getStyleableInfos
public Map<String,Class<?>> getStyleableInfos(JComponent c)
- Specified by:
getStyleableInfos
in interfaceFlatStylingSupport.StyleableUI
- Since:
- 2
-
getStyleableValue
public Object getStyleableValue(JComponent c, String key)
- Specified by:
getStyleableValue
in interfaceFlatStylingSupport.StyleableUI
- Since:
- 2.5
-
isFocusPainted
public static boolean isFocusPainted(Component c)
-
update
public void update(Graphics g, JComponent c)
- Overrides:
update
in classComponentUI
-
paintBackground
protected void paintBackground(Graphics g, JComponent c)
-
paint
public void paint(Graphics g, JComponent c)
- Overrides:
paint
in classBasicButtonUI
-
paintIcon
protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect)
- Overrides:
paintIcon
in classBasicButtonUI
-
paintText
protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text)
- Overrides:
paintText
in classBasicButtonUI
-
paintText
public static void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text, Color foreground)
-
getBackground
protected Color getBackground(JComponent c)
-
getBackgroundBase
protected Color getBackgroundBase(JComponent c, boolean def)
-
isCustomBackground
protected boolean isCustomBackground(Color bg)
-
buttonStateColor
public static Color buttonStateColor(Component c, Color enabledColor, Color disabledColor, Color focusedColor, Color hoverColor, Color pressedColor)
-
getForeground
protected Color getForeground(JComponent c)
-
getForegroundBase
protected Color getForegroundBase(JComponent c, boolean def)
- Since:
- 2.3
-
isCustomForeground
protected boolean isCustomForeground(Color fg)
-
getPreferredSize
public Dimension getPreferredSize(JComponent c)
- Overrides:
getPreferredSize
in classBasicButtonUI
-
-