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.hoverBackground Color optional, Button.pressedBackground Color optional, Button.selectedBackground Color, Button.selectedForeground Color, Button.disabledBackground Color optional, Button.disabledText Color, Button.disabledSelectedBackground Color, 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.hoverBackground Color optional, Button.default.pressedBackground 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.pressedBackground Color, Button.toolbar.selectedBackground Color
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classFlatButtonUI.FlatButtonListener
-
Field Summary
-
Fields inherited from class javax.swing.plaf.basic.BasicButtonUI
defaultTextIconGap, defaultTextShiftOffset
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFlatButtonUI(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
-
hoverBackground
protected Color hoverBackground
-
pressedBackground
protected Color pressedBackground
-
selectedBackground
protected Color selectedBackground
-
selectedForeground
protected Color selectedForeground
-
disabledBackground
protected Color disabledBackground
-
disabledText
protected Color disabledText
-
disabledSelectedBackground
protected Color disabledSelectedBackground
-
defaultBackground
protected Color defaultBackground
-
defaultEndBackground
protected Color defaultEndBackground
-
defaultForeground
protected Color defaultForeground
-
defaultFocusedBackground
protected Color defaultFocusedBackground
-
defaultHoverBackground
protected Color defaultHoverBackground
-
defaultPressedBackground
protected Color defaultPressedBackground
-
defaultBoldText
protected boolean defaultBoldText
-
paintShadow
protected boolean paintShadow
-
shadowWidth
protected int shadowWidth
-
shadowColor
protected Color shadowColor
-
defaultShadowColor
protected Color defaultShadowColor
-
toolbarHoverBackground
protected Color toolbarHoverBackground
-
toolbarPressedBackground
protected Color toolbarPressedBackground
-
toolbarSelectedBackground
protected Color toolbarSelectedBackground
-
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:
installUIin classBasicButtonUI
-
installDefaults
protected void installDefaults(AbstractButton b)
- Overrides:
installDefaultsin classBasicButtonUI
-
uninstallDefaults
protected void uninstallDefaults(AbstractButton b)
- Overrides:
uninstallDefaultsin classBasicButtonUI
-
createButtonListener
protected BasicButtonListener createButtonListener(AbstractButton b)
- Overrides:
createButtonListenerin 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:
getStyleableInfosin interfaceFlatStylingSupport.StyleableUI- Since:
- 2
-
isFocusPainted
public static boolean isFocusPainted(Component c)
-
update
public void update(Graphics g, JComponent c)
- Overrides:
updatein classComponentUI
-
paintBackground
protected void paintBackground(Graphics g, JComponent c)
-
paint
public void paint(Graphics g, JComponent c)
- Overrides:
paintin classBasicButtonUI
-
paintIcon
protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect)
- Overrides:
paintIconin classBasicButtonUI
-
paintText
protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text)
- Overrides:
paintTextin 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)
-
isCustomForeground
protected boolean isCustomForeground(Color fg)
-
getPreferredSize
public Dimension getPreferredSize(JComponent c)
- Overrides:
getPreferredSizein classBasicButtonUI
-
-