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
Provides the Flat LaF UI delegate for
JButton.
- Author:
- Karl Tauber
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Colorprotected Stringprotected Colorprotected booleanprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected intprotected intprotected intprotected booleanprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected intprotected booleanprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected Colorprotected ColorFields inherited from class javax.swing.plaf.basic.BasicButtonUI
defaultTextIconGap, defaultTextShiftOffset -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyStyle(AbstractButton b, Object style) protected ObjectapplyStyleProperty(AbstractButton b, String key, Object value) static ColorbuttonStateColor(Component c, Color enabledColor, Color disabledColor, Color focusedColor, Color hoverColor, Color pressedColor) protected BasicButtonListenerstatic ComponentUIprotected Colorprotected ColorgetBackgroundBase(JComponent c, boolean def) intgetBaseline(JComponent c, int width, int height) protected Colorprotected ColorgetForegroundBase(JComponent c, boolean def) getStyleableValue(JComponent c, String key) protected voidprotected voidprotected voidvoidprotected booleanprotected booleanstatic booleanvoidpaint(Graphics g, JComponent c) Similar to BasicButtonUI.paint(), but does not use zero insets for HTML text, which is done in BasicButtonUI.layout() since Java 19.protected voidprotected voidpaintIcon(Graphics g, JComponent c, Rectangle iconRect) protected voidpaintText(Graphics g, AbstractButton b, Rectangle textRect, String text) static voidprotected voidprotected voidprotected voidvoidupdate(Graphics g, JComponent c) Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, getPropertyPrefix, getTextShiftOffset, installKeyboardActions, paintButtonPressed, paintFocus, paintText, setTextShiftOffset, uninstallKeyboardActions, uninstallUIMethods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount
-
Field Details
-
minimumWidth
protected int minimumWidth -
iconTextGap
protected int iconTextGap -
background
-
foreground
-
startBackground
-
endBackground
-
focusedBackground
-
focusedForeground
- Since:
- 2.3
-
hoverBackground
-
hoverForeground
- Since:
- 2.3
-
pressedBackground
-
pressedForeground
- Since:
- 2.3
-
selectedBackground
-
selectedForeground
-
disabledBackground
-
disabledText
-
disabledSelectedBackground
-
disabledSelectedForeground
- Since:
- 2.3
-
defaultBackground
-
defaultEndBackground
-
defaultForeground
-
defaultFocusedBackground
-
defaultFocusedForeground
- Since:
- 2.3
-
defaultHoverBackground
-
defaultHoverForeground
- Since:
- 2.3
-
defaultPressedBackground
-
defaultPressedForeground
- Since:
- 2.3
-
defaultBoldText
protected boolean defaultBoldText -
paintShadow
protected boolean paintShadow -
shadowWidth
protected int shadowWidth -
shadowColor
-
defaultShadowColor
-
toolbarHoverBackground
-
toolbarHoverForeground
- Since:
- 2.3
-
toolbarPressedBackground
-
toolbarPressedForeground
- Since:
- 2.3
-
toolbarSelectedBackground
-
toolbarSelectedForeground
- Since:
- 2.3
-
toolbarDisabledSelectedBackground
- Since:
- 2.3
-
toolbarDisabledSelectedForeground
- Since:
- 2.3
-
buttonType
- Since:
- 2
-
squareSize
protected boolean squareSize- Since:
- 2
-
minimumHeight
protected int minimumHeight- Since:
- 2
-
-
Constructor Details
-
FlatButtonUI
protected FlatButtonUI(boolean shared) - Since:
- 2
-
-
Method Details
-
createUI
-
installUI
- Overrides:
installUIin classBasicButtonUI
-
installDefaults
- Overrides:
installDefaultsin classBasicButtonUI
-
uninstallDefaults
- Overrides:
uninstallDefaultsin classBasicButtonUI
-
installListeners
- Overrides:
installListenersin classBasicButtonUI
-
uninstallListeners
- Overrides:
uninstallListenersin classBasicButtonUI
-
createButtonListener
- Overrides:
createButtonListenerin classBasicButtonUI
-
propertyChange
-
installStyle
- Since:
- 2
-
applyStyle
- Since:
- 2
-
applyStyleProperty
- Since:
- 2
-
getStyleableInfos
- Specified by:
getStyleableInfosin interfaceFlatStylingSupport.StyleableUI- Since:
- 2
-
getStyleableValue
- Specified by:
getStyleableValuein interfaceFlatStylingSupport.StyleableUI- Since:
- 2.5
-
isFocusPainted
-
update
- Overrides:
updatein classComponentUI
-
paintBackground
-
paint
Similar to BasicButtonUI.paint(), but does not use zero insets for HTML text, which is done in BasicButtonUI.layout() since Java 19. See https://github.com/openjdk/jdk/pull/8407 and https://github.com/openjdk/jdk/pull/8407#issuecomment-1761583430- Overrides:
paintin classBasicButtonUI
-
paintIcon
- Overrides:
paintIconin classBasicButtonUI
-
paintText
- Overrides:
paintTextin classBasicButtonUI
-
paintText
public static void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text, Color foreground) -
getBackground
-
getBackgroundBase
-
isCustomBackground
-
buttonStateColor
-
getForeground
-
getForegroundBase
- Since:
- 2.3
-
isCustomForeground
-
getPreferredSize
- Overrides:
getPreferredSizein classBasicButtonUI
-
getBaseline
- Overrides:
getBaselinein classBasicButtonUI
-