Class FlatButtonUI

    • Field Detail

      • minimumWidth

        protected int minimumWidth
      • iconTextGap

        protected int iconTextGap
      • background

        protected java.awt.Color background
      • foreground

        protected java.awt.Color foreground
      • startBackground

        protected java.awt.Color startBackground
      • endBackground

        protected java.awt.Color endBackground
      • focusedBackground

        protected java.awt.Color focusedBackground
      • focusedForeground

        protected java.awt.Color focusedForeground
        Since:
        2.3
      • hoverBackground

        protected java.awt.Color hoverBackground
      • hoverForeground

        protected java.awt.Color hoverForeground
        Since:
        2.3
      • pressedBackground

        protected java.awt.Color pressedBackground
      • pressedForeground

        protected java.awt.Color pressedForeground
        Since:
        2.3
      • selectedBackground

        protected java.awt.Color selectedBackground
      • selectedForeground

        protected java.awt.Color selectedForeground
      • disabledBackground

        protected java.awt.Color disabledBackground
      • disabledText

        protected java.awt.Color disabledText
      • disabledSelectedBackground

        protected java.awt.Color disabledSelectedBackground
      • disabledSelectedForeground

        protected java.awt.Color disabledSelectedForeground
        Since:
        2.3
      • defaultBackground

        protected java.awt.Color defaultBackground
      • defaultEndBackground

        protected java.awt.Color defaultEndBackground
      • defaultForeground

        protected java.awt.Color defaultForeground
      • defaultFocusedBackground

        protected java.awt.Color defaultFocusedBackground
      • defaultFocusedForeground

        protected java.awt.Color defaultFocusedForeground
        Since:
        2.3
      • defaultHoverBackground

        protected java.awt.Color defaultHoverBackground
      • defaultHoverForeground

        protected java.awt.Color defaultHoverForeground
        Since:
        2.3
      • defaultPressedBackground

        protected java.awt.Color defaultPressedBackground
      • defaultPressedForeground

        protected java.awt.Color defaultPressedForeground
        Since:
        2.3
      • defaultBoldText

        protected boolean defaultBoldText
      • paintShadow

        protected boolean paintShadow
      • shadowWidth

        protected int shadowWidth
      • shadowColor

        protected java.awt.Color shadowColor
      • defaultShadowColor

        protected java.awt.Color defaultShadowColor
      • toolbarHoverBackground

        protected java.awt.Color toolbarHoverBackground
      • toolbarHoverForeground

        protected java.awt.Color toolbarHoverForeground
        Since:
        2.3
      • toolbarPressedBackground

        protected java.awt.Color toolbarPressedBackground
      • toolbarPressedForeground

        protected java.awt.Color toolbarPressedForeground
        Since:
        2.3
      • toolbarSelectedBackground

        protected java.awt.Color toolbarSelectedBackground
      • toolbarSelectedForeground

        protected java.awt.Color toolbarSelectedForeground
        Since:
        2.3
      • toolbarDisabledSelectedBackground

        protected java.awt.Color toolbarDisabledSelectedBackground
        Since:
        2.3
      • toolbarDisabledSelectedForeground

        protected java.awt.Color toolbarDisabledSelectedForeground
        Since:
        2.3
      • buttonType

        protected java.lang.String buttonType
        Since:
        2
      • squareSize

        protected boolean squareSize
        Since:
        2
      • minimumHeight

        protected int minimumHeight
        Since:
        2
      • helpButtonIcon

        private javax.swing.Icon helpButtonIcon
      • defaultMargin

        private java.awt.Insets defaultMargin
      • shared

        private final boolean shared
      • helpButtonIconShared

        private boolean helpButtonIconShared
      • defaults_initialized

        private boolean defaults_initialized
      • oldStyleValues

        private java.util.Map<java.lang.String,​java.lang.Object> oldStyleValues
      • borderShared

        private java.util.concurrent.atomic.AtomicBoolean borderShared
      • viewR

        private static java.awt.Rectangle viewR
      • textR

        private static java.awt.Rectangle textR
      • iconR

        private static java.awt.Rectangle iconR
    • Constructor Detail

      • FlatButtonUI

        protected FlatButtonUI​(boolean shared)
        Since:
        2
    • Method Detail

      • createUI

        public static javax.swing.plaf.ComponentUI createUI​(javax.swing.JComponent c)
      • installUI

        public void installUI​(javax.swing.JComponent c)
        Overrides:
        installUI in class javax.swing.plaf.basic.BasicButtonUI
      • installUIImpl

        private void installUIImpl​(javax.swing.JComponent c)
      • installDefaults

        protected void installDefaults​(javax.swing.AbstractButton b)
        Overrides:
        installDefaults in class javax.swing.plaf.basic.BasicButtonUI
      • uninstallDefaults

        protected void uninstallDefaults​(javax.swing.AbstractButton b)
        Overrides:
        uninstallDefaults in class javax.swing.plaf.basic.BasicButtonUI
      • createButtonListener

        protected javax.swing.plaf.basic.BasicButtonListener createButtonListener​(javax.swing.AbstractButton b)
        Overrides:
        createButtonListener in class javax.swing.plaf.basic.BasicButtonUI
      • propertyChange

        protected void propertyChange​(javax.swing.AbstractButton b,
                                      java.beans.PropertyChangeEvent e)
      • installStyle

        protected void installStyle​(javax.swing.AbstractButton b)
        Since:
        2
      • getStyleType

        java.lang.String getStyleType()
        Since:
        2
      • applyStyle

        protected void applyStyle​(javax.swing.AbstractButton b,
                                  java.lang.Object style)
        Since:
        2
      • applyStyleProperty

        protected java.lang.Object applyStyleProperty​(javax.swing.AbstractButton b,
                                                      java.lang.String key,
                                                      java.lang.Object value)
        Since:
        2
      • isContentAreaFilled

        static boolean isContentAreaFilled​(java.awt.Component c)
      • isFocusPainted

        public static boolean isFocusPainted​(java.awt.Component c)
      • isDefaultButton

        static boolean isDefaultButton​(java.awt.Component c)
      • isIconOnlyOrSingleCharacterButton

        static boolean isIconOnlyOrSingleCharacterButton​(java.awt.Component c)
        Returns true if the button has an icon but no text, or it does not have an icon and the text is either "..." or one character.
      • getButtonType

        static int getButtonType​(java.awt.Component c)
      • isHelpButton

        static boolean isHelpButton​(java.awt.Component c)
      • isToolBarButton

        static boolean isToolBarButton​(java.awt.Component c)
      • isBorderlessButton

        static boolean isBorderlessButton​(java.awt.Component c)
      • getButtonTypeStr

        static java.lang.String getButtonTypeStr​(javax.swing.AbstractButton c)
      • update

        public void update​(java.awt.Graphics g,
                           javax.swing.JComponent c)
        Overrides:
        update in class javax.swing.plaf.ComponentUI
      • paintBackground

        protected void paintBackground​(java.awt.Graphics g,
                                       javax.swing.JComponent c)
      • paint

        public void paint​(java.awt.Graphics g,
                          javax.swing.JComponent c)
        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:
        paint in class javax.swing.plaf.basic.BasicButtonUI
      • paintIcon

        protected void paintIcon​(java.awt.Graphics g,
                                 javax.swing.JComponent c,
                                 java.awt.Rectangle iconRect)
        Overrides:
        paintIcon in class javax.swing.plaf.basic.BasicButtonUI
      • paintText

        protected void paintText​(java.awt.Graphics g,
                                 javax.swing.AbstractButton b,
                                 java.awt.Rectangle textRect,
                                 java.lang.String text)
        Overrides:
        paintText in class javax.swing.plaf.basic.BasicButtonUI
      • paintText

        public static void paintText​(java.awt.Graphics g,
                                     javax.swing.AbstractButton b,
                                     java.awt.Rectangle textRect,
                                     java.lang.String text,
                                     java.awt.Color foreground)
      • getBackground

        protected java.awt.Color getBackground​(javax.swing.JComponent c)
      • getBackgroundBase

        protected java.awt.Color getBackgroundBase​(javax.swing.JComponent c,
                                                   boolean def)
      • isCustomBackground

        protected boolean isCustomBackground​(java.awt.Color bg)
      • buttonStateColor

        public static java.awt.Color buttonStateColor​(java.awt.Component c,
                                                      java.awt.Color enabledColor,
                                                      java.awt.Color disabledColor,
                                                      java.awt.Color focusedColor,
                                                      java.awt.Color hoverColor,
                                                      java.awt.Color pressedColor)
      • getForeground

        protected java.awt.Color getForeground​(javax.swing.JComponent c)
      • getForegroundBase

        protected java.awt.Color getForegroundBase​(javax.swing.JComponent c,
                                                   boolean def)
        Since:
        2.3
      • isCustomForeground

        protected boolean isCustomForeground​(java.awt.Color fg)
      • getPreferredSize

        public java.awt.Dimension getPreferredSize​(javax.swing.JComponent c)
        Overrides:
        getPreferredSize in class javax.swing.plaf.basic.BasicButtonUI
      • defaultBoldPlainWidthDiff

        private int defaultBoldPlainWidthDiff​(javax.swing.JComponent c)
      • hasDefaultMargins

        private boolean hasDefaultMargins​(javax.swing.JComponent c)
      • getBaseline

        public int getBaseline​(javax.swing.JComponent c,
                               int width,
                               int height)
        Overrides:
        getBaseline in class javax.swing.plaf.basic.BasicButtonUI
      • getBaselineImpl

        static int getBaselineImpl​(javax.swing.JComponent c,
                                   int width,
                                   int height)
        Similar to BasicButtonUI.getBaseline(), 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
      • layout

        private static java.lang.String layout​(javax.swing.AbstractButton b,
                                               java.awt.FontMetrics fm,
                                               int width,
                                               int height)
        Similar to BasicButtonUI.layout(), 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