Interface FlatClientProperties


  • public interface FlatClientProperties
    Defines/documents own client properties used in FlatLaf.
    • Field Detail

      • BUTTON_TYPE_SQUARE

        static final java.lang.String BUTTON_TYPE_SQUARE
        Paint the button with square edges.

        Components JButton and JToggleButton

        See Also:
        BUTTON_TYPE, Constant Field Values
      • BUTTON_TYPE_ROUND_RECT

        static final java.lang.String BUTTON_TYPE_ROUND_RECT
        Paint the button with round edges.

        Components JButton and JToggleButton

        See Also:
        BUTTON_TYPE, Constant Field Values
      • BUTTON_TYPE_TAB

        static final java.lang.String BUTTON_TYPE_TAB
        Paint the toggle button in tab style.

        Components JToggleButton

        See Also:
        BUTTON_TYPE, Constant Field Values
      • BUTTON_TYPE_HELP

        static final java.lang.String BUTTON_TYPE_HELP
        Paint a help button (circle with question mark).

        Components JButton

        See Also:
        BUTTON_TYPE, Constant Field Values
      • BUTTON_TYPE_TOOLBAR_BUTTON

        static final java.lang.String BUTTON_TYPE_TOOLBAR_BUTTON
        Paint the button in toolbar style.

        Components JButton and JToggleButton

        See Also:
        BUTTON_TYPE, Constant Field Values
      • SELECTED_STATE_INDETERMINATE

        static final java.lang.String SELECTED_STATE_INDETERMINATE
        Paint an indeterminate state on a checkbox.
        See Also:
        SELECTED_STATE, Constant Field Values
      • SQUARE_SIZE

        static final java.lang.String SQUARE_SIZE
        Specifies whether the button preferred size will be made square (quadratically).

        Components JButton and JToggleButton
        Value type Boolean

        See Also:
        Constant Field Values
      • MINIMUM_WIDTH

        static final java.lang.String MINIMUM_WIDTH
        Specifies minimum width of a component.

        Component JButton, JToggleButton, JComboBox, JSpinner and JTextComponent
        Value type Integer

        See Also:
        Constant Field Values
      • MINIMUM_HEIGHT

        static final java.lang.String MINIMUM_HEIGHT
        Specifies minimum height of a component.

        Component JButton and JToggleButton
        Value type Integer

        See Also:
        Constant Field Values
      • COMPONENT_ROUND_RECT

        static final java.lang.String COMPONENT_ROUND_RECT
        Paint the component with round edges.

        Components JComboBox, JSpinner, JTextField, JFormattedTextField and JPasswordField
        Value type Boolean

        See Also:
        Constant Field Values
      • OUTLINE

        static final java.lang.String OUTLINE
        Specifies the outline color of the component border.

        Components JButton, JComboBox, JFormattedTextField, JPasswordField, JScrollPane, JSpinner, JTextField and JToggleButton
        Value type String or Color or Color[2]
        Allowed Values OUTLINE_ERROR, OUTLINE_WARNING, any color (type Color) or an array of two colors (type Color[2]) where the first color is for focused state and the second for unfocused state

        See Also:
        Constant Field Values
      • OUTLINE_ERROR

        static final java.lang.String OUTLINE_ERROR
        Paint the component border in another color (usually reddish) to indicate an error.
        See Also:
        OUTLINE, Constant Field Values
      • OUTLINE_WARNING

        static final java.lang.String OUTLINE_WARNING
        Paint the component border in another color (usually yellowish) to indicate a warning.
        See Also:
        OUTLINE, Constant Field Values
      • COMPONENT_FOCUS_OWNER

        static final java.lang.String COMPONENT_FOCUS_OWNER
        Specifies a callback that is invoked to check whether a component is permanent focus owner. Used to paint focus indicators.

        May be useful in special cases for custom components.

        Use a Predicate that receives the component as parameter:

        
         myComponent.putClientProperty( "JComponent.focusOwner",
             (Predicate<JComponent>) c -> {
                 return ...; // check here
             } );
         

        Component JComponent
        Value type Predicate<javax.swing.JComponent>

        See Also:
        Constant Field Values
      • POPUP_DROP_SHADOW_PAINTED

        static final java.lang.String POPUP_DROP_SHADOW_PAINTED
        Specifies whether a drop shadow is painted if the component is shown in a popup or if the component is the owner of another component that is shown in a popup.

        Component JComponent
        Value type Boolean

        See Also:
        Constant Field Values
      • POPUP_FORCE_HEAVY_WEIGHT

        static final java.lang.String POPUP_FORCE_HEAVY_WEIGHT
        Specifies whether a heavy weight window should be used if the component is shown in a popup or if the component is the owner of another component that is shown in a popup.

        Component JComponent
        Value type Boolean

        See Also:
        Constant Field Values
      • PROGRESS_BAR_LARGE_HEIGHT

        static final java.lang.String PROGRESS_BAR_LARGE_HEIGHT
        Specifies whether the progress bar has always the larger height even if no string is painted.

        Component JProgressBar
        Value type Boolean

        See Also:
        Constant Field Values
      • PROGRESS_BAR_SQUARE

        static final java.lang.String PROGRESS_BAR_SQUARE
        Specifies whether the progress bar is paint with square edges.

        Component JProgressBar
        Value type Boolean

        See Also:
        Constant Field Values
      • MENU_BAR_EMBEDDED

        static final java.lang.String MENU_BAR_EMBEDDED
        Specifies whether the menu bar is embedded into the title pane if custom window decorations are enabled. Default is true.

        Component JRootPane
        Value type Boolean

        See Also:
        Constant Field Values
      • SCROLL_BAR_SHOW_BUTTONS

        static final java.lang.String SCROLL_BAR_SHOW_BUTTONS
        Specifies whether the decrease/increase arrow buttons of a scrollbar are shown.

        Component JScrollBar or JScrollPane
        Value type Boolean

        See Also:
        Constant Field Values
      • SCROLL_PANE_SMOOTH_SCROLLING

        static final java.lang.String SCROLL_PANE_SMOOTH_SCROLLING
        Specifies whether the scroll pane uses smooth scrolling.

        Component JScrollPane
        Value type Boolean

        See Also:
        Constant Field Values
      • TABBED_PANE_SHOW_TAB_SEPARATORS

        static final java.lang.String TABBED_PANE_SHOW_TAB_SEPARATORS
        Specifies whether separators are shown between tabs.

        Component JTabbedPane
        Value type Boolean

        See Also:
        Constant Field Values
      • TABBED_PANE_SHOW_CONTENT_SEPARATOR

        static final java.lang.String TABBED_PANE_SHOW_CONTENT_SEPARATOR
        Specifies whether the separator between tabs area and content area should be shown.

        Component JTabbedPane
        Value type Boolean

        See Also:
        Constant Field Values
      • TABBED_PANE_HAS_FULL_BORDER

        static final java.lang.String TABBED_PANE_HAS_FULL_BORDER
        Specifies whether a full border is painted around a tabbed pane.

        Component JTabbedPane
        Value type Boolean

        See Also:
        Constant Field Values
      • TABBED_PANE_HIDE_TAB_AREA_WITH_ONE_TAB

        static final java.lang.String TABBED_PANE_HIDE_TAB_AREA_WITH_ONE_TAB
        Specifies whether the tab area should be hidden if it contains only one tab.

        Component JTabbedPane
        Value type Boolean

        See Also:
        Constant Field Values
      • TABBED_PANE_MINIMUM_TAB_WIDTH

        static final java.lang.String TABBED_PANE_MINIMUM_TAB_WIDTH
        Specifies the minimum width of a tab.

        Component JTabbedPane or tab content components (see JTabbedPane.setComponentAt(int, java.awt.Component))
        Value type Integer

        See Also:
        Constant Field Values
      • TABBED_PANE_MAXIMUM_TAB_WIDTH

        static final java.lang.String TABBED_PANE_MAXIMUM_TAB_WIDTH
        Specifies the maximum width of a tab.

        Applied only if tab does not have a custom tab component (see JTabbedPane.setTabComponentAt(int, java.awt.Component)).

        Component JTabbedPane or tab content components (see JTabbedPane.setComponentAt(int, java.awt.Component))
        Value type Integer

        See Also:
        Constant Field Values
      • TABBED_PANE_TAB_INSETS

        static final java.lang.String TABBED_PANE_TAB_INSETS
        Specifies the insets of a tab.

        Component JTabbedPane or tab content components (see JTabbedPane.setComponentAt(int, java.awt.Component))
        Value type Insets

        See Also:
        TABBED_PANE_TAB_HEIGHT, Constant Field Values
      • TABBED_PANE_TAB_AREA_INSETS

        static final java.lang.String TABBED_PANE_TAB_AREA_INSETS
        Specifies the insets of the tab area.

        Component JTabbedPane
        Value type Insets

        See Also:
        Constant Field Values
      • TABBED_PANE_TAB_CLOSABLE

        static final java.lang.String TABBED_PANE_TAB_CLOSABLE
        Specifies whether tabs are closable. If set to true on a tabbed pane component, all tabs in that tabbed pane are closable. To make individual tabs closable, set it to true on a tab content component.

        Note that you have to specify a callback (see TABBED_PANE_TAB_CLOSABLE) that is invoked when the user clicks a tab close button. The callback is responsible for closing the tab.

        Component JTabbedPane or tab content components (see JTabbedPane.setComponentAt(int, java.awt.Component))
        Value type Boolean

        See Also:
        TABBED_PANE_TAB_CLOSE_CALLBACK, Constant Field Values
      • TABBED_PANE_TAB_CLOSE_TOOLTIPTEXT

        static final java.lang.String TABBED_PANE_TAB_CLOSE_TOOLTIPTEXT
        Specifies the tooltip text used for tab close buttons.

        Component JTabbedPane or tab content components (see JTabbedPane.setComponentAt(int, java.awt.Component))
        Value type String

        See Also:
        TABBED_PANE_TAB_CLOSABLE, Constant Field Values
      • TABBED_PANE_TAB_CLOSE_CALLBACK

        static final java.lang.String TABBED_PANE_TAB_CLOSE_CALLBACK
        Specifies the callback that is invoked when a tab close button is clicked. The callback is responsible for closing the tab.

        Either use a IntConsumer that receives the tab index as parameter:

        
         myTabbedPane.putClientProperty( "JTabbedPane.tabCloseCallback",
             (IntConsumer) tabIndex -> {
                 // close tab here
             } );
         
        Or use a BiConsumer<javax.swing.JTabbedPane, Integer> that receives the tabbed pane and the tab index as parameters:
        
         myTabbedPane.putClientProperty( "JTabbedPane.tabCloseCallback",
             (BiConsumer<JTabbedPane, Integer>) (tabbedPane, tabIndex) -> {
                 // close tab here
             } );
         
        If you need to check whether a modifier key (e.g. Alt or Shift) was pressed while the user clicked the tab close button, use EventQueue.getCurrentEvent() to get current event, check whether it is a MouseEvent and invoke its methods. E.g.
        
         AWTEvent e = EventQueue.getCurrentEvent();
         boolean shift = (e instanceof MouseEvent) ? ((MouseEvent)e).isShiftDown() : false;
         

        Component JTabbedPane or tab content components (see JTabbedPane.setComponentAt(int, java.awt.Component))
        Value type IntConsumer or BiConsumer<javax.swing.JTabbedPane, Integer>

        See Also:
        TABBED_PANE_TAB_CLOSABLE, Constant Field Values
      • TABBED_PANE_POLICY_AS_NEEDED_SINGLE

        static final java.lang.String TABBED_PANE_POLICY_AS_NEEDED_SINGLE
        Display single button only when needed.

        If scroll button placement is trailing, then this option is ignored and both buttons are shown or hidden as needed.

        See Also:
        TABBED_PANE_SCROLL_BUTTONS_POLICY, Constant Field Values
      • TABBED_PANE_PLACEMENT_BOTH

        static final java.lang.String TABBED_PANE_PLACEMENT_BOTH
        The forward/backward scroll arrow buttons are placed on both sides of the tab area. The backward scroll button at the left/top side. The forward scroll button at the right/bottom side.
        See Also:
        TABBED_PANE_SCROLL_BUTTONS_PLACEMENT, Constant Field Values
      • TABBED_PANE_TAB_ALIGNMENT

        static final java.lang.String TABBED_PANE_TAB_ALIGNMENT
        Specifies the horizontal alignment of the tab title and icon.

        Component JTabbedPane or tab content components (see JTabbedPane.setComponentAt(int, java.awt.Component))
        Value type Integer or String
        Allowed Values SwingConstants.LEADING, SwingConstants.TRAILING, SwingConstants.CENTER (default), TABBED_PANE_ALIGN_LEADING, TABBED_PANE_ALIGN_TRAILING or TABBED_PANE_ALIGN_CENTER (default)

        See Also:
        Constant Field Values
      • TABBED_PANE_TAB_WIDTH_MODE_COMPACT

        static final java.lang.String TABBED_PANE_TAB_WIDTH_MODE_COMPACT
        Unselected tabs are smaller because they show only the tab icon, but no tab title. Selected tabs show both.
        See Also:
        TABBED_PANE_TAB_WIDTH_MODE, Constant Field Values
      • TABBED_PANE_TAB_ICON_PLACEMENT

        static final java.lang.String TABBED_PANE_TAB_ICON_PLACEMENT
        Specifies the tab icon placement (relative to tab title).

        Component JTabbedPane
        Value type Integer
        Allowed Values SwingConstants.LEADING (default), SwingConstants.TRAILING, SwingConstants.TOP or SwingConstants.BOTTOM

        See Also:
        Constant Field Values
      • TABBED_PANE_LEADING_COMPONENT

        static final java.lang.String TABBED_PANE_LEADING_COMPONENT
        Specifies a component that will be placed at the leading edge of the tabs area.

        For top and bottom tab placement, the layed out component size will be the preferred component width and the tab area height.
        For left and right tab placement, the layed out component size will be the tab area width and the preferred component height.

        Component JTabbedPane
        Value type Component

        See Also:
        Constant Field Values
      • TABBED_PANE_TRAILING_COMPONENT

        static final java.lang.String TABBED_PANE_TRAILING_COMPONENT
        Specifies a component that will be placed at the trailing edge of the tabs area.

        For top and bottom tab placement, the layed out component size will be the available horizontal space (minimum is preferred component width) and the tab area height.
        For left and right tab placement, the layed out component size will be the tab area width and the available vertical space (minimum is preferred component height).

        Component JTabbedPane
        Value type Component

        See Also:
        Constant Field Values
      • SELECT_ALL_ON_FOCUS_POLICY_ONCE

        static final java.lang.String SELECT_ALL_ON_FOCUS_POLICY_ONCE
        Select all text when the text component gains focus for the first time and selection was not modified (is at end of text). This is the default.
        See Also:
        SELECT_ALL_ON_FOCUS_POLICY, Constant Field Values
      • PLACEHOLDER_TEXT

        static final java.lang.String PLACEHOLDER_TEXT
        Placeholder text that is only painted if the text field is empty.

        Component JTextField (and subclasses) or JComboBox
        Value type String

        See Also:
        Constant Field Values
      • TAB_BUTTON_UNDERLINE_HEIGHT

        static final java.lang.String TAB_BUTTON_UNDERLINE_HEIGHT
        Height of underline if toggle button type is BUTTON_TYPE_TAB.

        Component JToggleButton
        Value type Integer

        See Also:
        Constant Field Values
      • TAB_BUTTON_UNDERLINE_COLOR

        static final java.lang.String TAB_BUTTON_UNDERLINE_COLOR
        Color of underline if toggle button type is BUTTON_TYPE_TAB.

        Component JToggleButton
        Value type Color

        See Also:
        Constant Field Values
      • TAB_BUTTON_SELECTED_BACKGROUND

        static final java.lang.String TAB_BUTTON_SELECTED_BACKGROUND
        Background color if selected and toggle button type is BUTTON_TYPE_TAB.

        Component JToggleButton
        Value type Color

        See Also:
        Constant Field Values
      • TREE_WIDE_SELECTION

        static final java.lang.String TREE_WIDE_SELECTION
        Override if a tree shows a wide selection. Default is true.

        Component JTree
        Value type Boolean

        See Also:
        Constant Field Values
      • TREE_PAINT_SELECTION

        static final java.lang.String TREE_PAINT_SELECTION
        Specifies whether tree item selection is painted. Default is true. If set to false, then the tree cell renderer is responsible for painting selection.

        Component JTree
        Value type Boolean

        See Also:
        Constant Field Values
    • Method Detail

      • clientPropertyEquals

        static boolean clientPropertyEquals​(javax.swing.JComponent c,
                                            java.lang.String key,
                                            java.lang.Object value)
        Checks whether a client property of a component has the given value.
      • clientPropertyBoolean

        static boolean clientPropertyBoolean​(javax.swing.JComponent c,
                                             java.lang.String key,
                                             boolean defaultValue)
        Checks whether a client property of a component is a boolean and returns its value. If the client property is not set, or not a boolean, defaultValue is returned.
      • clientPropertyBooleanStrict

        static java.lang.Boolean clientPropertyBooleanStrict​(javax.swing.JComponent c,
                                                             java.lang.String key,
                                                             java.lang.Boolean defaultValue)
        Checks whether a client property of a component is a Boolean and returns its value. If the client property is not set, or not a Boolean, defaultValue is returned.
      • clientPropertyInt

        static int clientPropertyInt​(javax.swing.JComponent c,
                                     java.lang.String key,
                                     int defaultValue)
        Checks whether a client property of a component is an integer and returns its value. If the client property is not set, or not an integer, defaultValue is returned.
      • clientPropertyColor

        static java.awt.Color clientPropertyColor​(javax.swing.JComponent c,
                                                  java.lang.String key,
                                                  java.awt.Color defaultValue)
        Checks whether a client property of a component is a color and returns its value. If the client property is not set, or not a color, defaultValue is returned.