Interface FlatClientProperties
-
public interface FlatClientProperties
Defines/documents own client properties used in FlatLaf.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
BUTTON_TYPE
Specifies type of button.static java.lang.String
BUTTON_TYPE_BORDERLESS
Paint the button without a border in the unfocused state.static java.lang.String
BUTTON_TYPE_HELP
Paint a help button (circle with question mark).static java.lang.String
BUTTON_TYPE_ROUND_RECT
Paint the button with round edges.static java.lang.String
BUTTON_TYPE_SQUARE
Paint the button with square edges.static java.lang.String
BUTTON_TYPE_TAB
Paint the toggle button in tab style.static java.lang.String
BUTTON_TYPE_TOOLBAR_BUTTON
Paint the button in toolbar style.static java.lang.String
COMPONENT_FOCUS_OWNER
Specifies a callback that is invoked to check whether a component is permanent focus owner.static java.lang.String
COMPONENT_ROUND_RECT
Paint the component with round edges.static java.lang.String
COMPONENT_TITLE_BAR_CAPTION
Specifies whether a component shown in a window title bar area should behave as caption (left-click allows moving window, right-click shows window system menu).static java.lang.String
FULL_WINDOW_CONTENT
Specifies whether the content pane (and the glass pane) should be extended into the window title bar area (requires enabled window decorations).static java.lang.String
FULL_WINDOW_CONTENT_BUTTONS_BOUNDS
Contains the current bounds of the iconfify/maximize/close buttons (in root pane coordinates) if fullWindowContent mode is enabled.static java.lang.String
FULL_WINDOW_CONTENT_BUTTONS_PLACEHOLDER
Marks the panel as placeholder for the iconfify/maximize/close buttons in fullWindowContent mode.static java.lang.String
GLASS_PANE_FULL_HEIGHT
Specifies whether the glass pane should have full height and overlap the title bar, if FlatLaf window decorations are enabled.static java.lang.String
MACOS_WINDOW_BUTTONS_SPACING
Specifies the spacing around the macOS window close/minimize/zoom buttons.static java.lang.String
MACOS_WINDOW_BUTTONS_SPACING_LARGE
Add large spacing around the macOS window close/minimize/zoom buttons.static java.lang.String
MACOS_WINDOW_BUTTONS_SPACING_MEDIUM
Add medium spacing around the macOS window close/minimize/zoom buttons.static java.lang.String
MENU_BAR_EMBEDDED
Specifies whether the menu bar is embedded into the window title pane if window decorations are enabled.static java.lang.String
MINIMUM_HEIGHT
Specifies minimum height of a component.static java.lang.String
MINIMUM_WIDTH
Specifies minimum width of a component.static java.lang.String
OUTLINE
Specifies the outline color of the component border.static java.lang.String
OUTLINE_ERROR
Paint the component border in another color (usually reddish) to indicate an error.static java.lang.String
OUTLINE_WARNING
Paint the component border in another color (usually yellowish) to indicate a warning.static java.lang.String
PLACEHOLDER_TEXT
Placeholder text that is only painted if the text field is empty.static java.lang.String
POPUP_BORDER_CORNER_RADIUS
Specifies the popup border corner radius if the component is shown in a popup or if the component is the owner of another component that is shown in a popup.static 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.static 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.static java.lang.String
POPUP_ROUNDED_BORDER_WIDTH
Specifies the popup rounded border width if the component is shown in a popup or if the component is the owner of another component that is shown in a popup.static java.lang.String
PROGRESS_BAR_LARGE_HEIGHT
Specifies whether the progress bar has always the larger height even if no string is painted.static java.lang.String
PROGRESS_BAR_SQUARE
Specifies whether the progress bar is paint with square edges.static java.lang.String
SCROLL_BAR_SHOW_BUTTONS
Specifies whether the decrease/increase arrow buttons of a scrollbar are shown.static java.lang.String
SCROLL_PANE_SMOOTH_SCROLLING
Specifies whether the scroll pane uses smooth scrolling.static java.lang.String
SELECT_ALL_ON_FOCUS_POLICY
Specifies whether all text is selected when the text component gains focus.static java.lang.String
SELECT_ALL_ON_FOCUS_POLICY_ALWAYS
Always select all text when the text component gains focus.static java.lang.String
SELECT_ALL_ON_FOCUS_POLICY_NEVER
Never select all text when the text component gains focus.static 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).static java.lang.String
SELECTED_STATE
Specifies selected state of a checkbox.static java.lang.String
SELECTED_STATE_INDETERMINATE
Paint an indeterminate state on a checkbox.static java.lang.String
SPLIT_PANE_EXPANDABLE_SIDE
Specifies what side of the spilt pane is allowed to expand via one-touch expanding arrow buttons.static java.lang.String
SPLIT_PANE_EXPANDABLE_SIDE_LEFT
Allow expanding only left/top side of the split pane.static java.lang.String
SPLIT_PANE_EXPANDABLE_SIDE_RIGHT
Allow expanding only right/bottom side of the split pane.static java.lang.String
SQUARE_SIZE
Specifies whether the button preferred size will be made square (quadratically).static java.lang.String
STYLE
Specifies the style of a component as String in CSS syntax ("key1: value1; key2: value2; ...") or asMap
<String, Object> with binary values.static java.lang.String
STYLE_CLASS
Specifies the style class(es) of a component as String (single class or multiple classes separated by space characters) or asString[]
orList
<String> (multiple classes).static java.lang.String
TAB_BUTTON_SELECTED_BACKGROUND
Background color if selected and toggle button type isBUTTON_TYPE_TAB
.static java.lang.String
TAB_BUTTON_UNDERLINE_COLOR
Color of underline if toggle button type isBUTTON_TYPE_TAB
.static java.lang.String
TAB_BUTTON_UNDERLINE_HEIGHT
Thickness of underline if toggle button type isBUTTON_TYPE_TAB
.static java.lang.String
TAB_BUTTON_UNDERLINE_PLACEMENT
Placement of underline if toggle button type isBUTTON_TYPE_TAB
static java.lang.String
TABBED_PANE_ALIGN_CENTER
Align to center.static java.lang.String
TABBED_PANE_ALIGN_FILL
Stretch to fill all available space.static java.lang.String
TABBED_PANE_ALIGN_LEADING
Align to the leading edge.static java.lang.String
TABBED_PANE_ALIGN_TRAILING
Align to the trailing edge.static java.lang.String
TABBED_PANE_HAS_FULL_BORDER
Specifies whether a full border is painted around a tabbed pane.static 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.static java.lang.String
TABBED_PANE_LEADING_COMPONENT
Specifies a component that will be placed at the leading edge of the tabs area.static java.lang.String
TABBED_PANE_MAXIMUM_TAB_WIDTH
Specifies the maximum width of a tab.static java.lang.String
TABBED_PANE_MINIMUM_TAB_WIDTH
Specifies the minimum width of a tab.static java.lang.String
TABBED_PANE_PLACEMENT_BOTH
The forward/backward scroll arrow buttons are placed on both sides of the tab area.static java.lang.String
TABBED_PANE_PLACEMENT_TRAILING
The forward/backward scroll arrow buttons are placed on the trailing side of the tab area.static java.lang.String
TABBED_PANE_POLICY_AS_NEEDED
Display only when needed.static java.lang.String
TABBED_PANE_POLICY_AS_NEEDED_SINGLE
Display single button only when needed.static java.lang.String
TABBED_PANE_POLICY_NEVER
Display never.static java.lang.String
TABBED_PANE_SCROLL_BUTTONS_PLACEMENT
Specifies the placement of the forward/backward scroll arrow buttons.static java.lang.String
TABBED_PANE_SCROLL_BUTTONS_POLICY
Specifies the display policy for the forward/backward scroll arrow buttons.static java.lang.String
TABBED_PANE_SHOW_CONTENT_SEPARATOR
Specifies whether the separator between tabs area and content area should be shown.static java.lang.String
TABBED_PANE_SHOW_TAB_SEPARATORS
Specifies whether separators are shown between tabs.static java.lang.String
TABBED_PANE_TAB_ALIGNMENT
Specifies the horizontal alignment of the tab title and icon.static java.lang.String
TABBED_PANE_TAB_AREA_ALIGNMENT
Specifies the alignment of the tab area.static java.lang.String
TABBED_PANE_TAB_AREA_INSETS
Specifies the insets of the tab area.static java.lang.String
TABBED_PANE_TAB_CLOSABLE
Specifies whether tabs are closable.static java.lang.String
TABBED_PANE_TAB_CLOSE_CALLBACK
Specifies the callback that is invoked when a tab close button is clicked.static java.lang.String
TABBED_PANE_TAB_CLOSE_TOOLTIPTEXT
Specifies the tooltip text used for tab close buttons.static java.lang.String
TABBED_PANE_TAB_HEIGHT
Specifies the minimum height of a tab.static java.lang.String
TABBED_PANE_TAB_ICON_PLACEMENT
Specifies the tab icon placement (relative to tab title).static java.lang.String
TABBED_PANE_TAB_INSETS
Specifies the insets of a tab.static java.lang.String
TABBED_PANE_TAB_ROTATION
Specifies the rotation of the tabs (title, icon, etc.).static java.lang.String
TABBED_PANE_TAB_ROTATION_AUTO
Tabs are rotated depending on tab placement.static java.lang.String
TABBED_PANE_TAB_ROTATION_LEFT
Tabs are rotated counter-clockwise.static java.lang.String
TABBED_PANE_TAB_ROTATION_NONE
Tabs are not rotated.static java.lang.String
TABBED_PANE_TAB_ROTATION_RIGHT
Tabs are rotated clockwise.static java.lang.String
TABBED_PANE_TAB_TYPE
Specifies type of the selected tab.static java.lang.String
TABBED_PANE_TAB_TYPE_CARD
Paint the selected tab as card.static java.lang.String
TABBED_PANE_TAB_TYPE_UNDERLINED
Paint the selected tab underlined.static java.lang.String
TABBED_PANE_TAB_WIDTH_MODE
Specifies how the tabs should be sized.static java.lang.String
TABBED_PANE_TAB_WIDTH_MODE_COMPACT
Unselected tabs are smaller because they show only the tab icon, but no tab title.static java.lang.String
TABBED_PANE_TAB_WIDTH_MODE_EQUAL
All tabs in a tabbed pane has same width.static java.lang.String
TABBED_PANE_TAB_WIDTH_MODE_PREFERRED
Tab width is adjusted to tab icon and title.static java.lang.String
TABBED_PANE_TABS_POPUP_POLICY
Specifies the display policy for the "more tabs" button, which shows a popup menu with the (partly) hidden tabs.static java.lang.String
TABBED_PANE_TRAILING_COMPONENT
Specifies a component that will be placed at the trailing edge of the tabs area.static java.lang.String
TEXT_FIELD_CLEAR_CALLBACK
Specifies the callback that is invoked when a "clear" (or "cancel") button is clicked.static java.lang.String
TEXT_FIELD_LEADING_COMPONENT
Specifies a component that will be placed at the leading edge of the text field.static java.lang.String
TEXT_FIELD_LEADING_ICON
Specifies an icon that will be placed at the leading edge of the text field.static java.lang.String
TEXT_FIELD_PADDING
Specifies the padding of the text.static java.lang.String
TEXT_FIELD_SHOW_CLEAR_BUTTON
Specifies whether a "clear" (or "cancel") button is shown on the trailing side if the text field is not empty, editable and enabled.static java.lang.String
TEXT_FIELD_TRAILING_COMPONENT
Specifies a component that will be placed at the trailing edge of the text field.static java.lang.String
TEXT_FIELD_TRAILING_ICON
Specifies an icon that will be placed at the trailing edge of the text field.static java.lang.String
TITLE_BAR_BACKGROUND
Background color of window title bar (requires enabled window decorations).static java.lang.String
TITLE_BAR_FOREGROUND
Foreground color of window title bar (requires enabled window decorations).static java.lang.String
TITLE_BAR_SHOW_CLOSE
Specifies whether the "close" button should be shown in the window title bar (requires enabled window decorations).static java.lang.String
TITLE_BAR_SHOW_ICON
Specifies whether the window icon should be shown in the window title bar (requires enabled window decorations).static java.lang.String
TITLE_BAR_SHOW_ICONIFFY
Specifies whether the "iconify" button should be shown in the window title bar (requires enabled window decorations).static java.lang.String
TITLE_BAR_SHOW_MAXIMIZE
Specifies whether the "maximize/restore" button should be shown in the window title bar (requires enabled window decorations).static java.lang.String
TITLE_BAR_SHOW_TITLE
Specifies whether the window title should be shown in the window title bar (requires enabled window decorations).static java.lang.String
TREE_PAINT_SELECTION
Specifies whether tree item selection is painted.static java.lang.String
TREE_WIDE_SELECTION
Override if a tree shows a wide selection.static java.lang.String
USE_WINDOW_DECORATIONS
Specifies whether FlatLaf native window decorations should be used forJFrame
orJDialog
.static java.lang.String
WINDOW_STYLE
Specifies the style of the window title bar.static java.lang.String
WINDOW_STYLE_SMALL
The window has Utility-style title bar, which is smaller than default title bar.
-
Method Summary
Static Methods Modifier and Type Method Description static <T> T
clientProperty(javax.swing.JComponent c, java.lang.String key, T defaultValue, java.lang.Class<T> type)
Returns the value of the specified client property if it is an instance of the specified type.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.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 aBoolean
and returns its value.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.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.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.
-
-
-
Field Detail
-
BUTTON_TYPE
static final java.lang.String BUTTON_TYPE
Specifies type of button.Components
JButton
andJToggleButton
Value typeString
Allowed ValuesBUTTON_TYPE_SQUARE
,BUTTON_TYPE_ROUND_RECT
,BUTTON_TYPE_TAB
,BUTTON_TYPE_HELP
,BUTTON_TYPE_TOOLBAR_BUTTON
orBUTTON_TYPE_BORDERLESS
- See Also:
- Constant Field Values
-
BUTTON_TYPE_SQUARE
static final java.lang.String BUTTON_TYPE_SQUARE
Paint the button with square edges.Components
JButton
andJToggleButton
- 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
andJToggleButton
- 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
andJToggleButton
- See Also:
BUTTON_TYPE
, Constant Field Values
-
BUTTON_TYPE_BORDERLESS
static final java.lang.String BUTTON_TYPE_BORDERLESS
Paint the button without a border in the unfocused state.Components
JButton
andJToggleButton
- Since:
- 1.2
- See Also:
BUTTON_TYPE
, 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
andJToggleButton
Value typeBoolean
- See Also:
- Constant Field Values
-
SELECTED_STATE
static final java.lang.String SELECTED_STATE
Specifies selected state of a checkbox.Component
JCheckBox
Value typeString
Allowed ValuesSELECTED_STATE_INDETERMINATE
- See Also:
- 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
-
STYLE
static final java.lang.String STYLE
Specifies the style of a component as String in CSS syntax ("key1: value1; key2: value2; ...") or asMap
<String, Object> with binary values.The keys are the same as used in UI defaults, but without component type prefix. E.g. for UI default
Slider.thumbSize
use keythumbSize
.The syntax of the CSS values is the same as used in FlatLaf properties files (https://www.formdev.com/flatlaf/properties-files/), but some features are not supported (e.g. variables). When using a map, the values are not parsed from a string. They must be binary.
Components
JComponent
Value typeString
orMap
<String, Object>- Since:
- 2
- See Also:
- Constant Field Values
-
STYLE_CLASS
static final java.lang.String STYLE_CLASS
Specifies the style class(es) of a component as String (single class or multiple classes separated by space characters) or asString[]
orList
<String> (multiple classes).The style rules must be defined in UI defaults either as strings (in CSS syntax) or as
Map
<String, Object> (with binary values). The key must be in syntax:[style]type.styleClass
, where the type is optional. E.g. in FlatLaf properties file:
or in Java code:[style]Button.primary = borderColor: #08f; background: #08f; foreground: #fff [style].secondary = borderColor: #0f8; background: #0f8
The rule "Button.primary" can be applied to buttons only. The rule ".secondary" can be applied to any component.UIManager.put( "[style]Button.primary", "borderColor: #08f; background: #08f; foreground: #fff" ); UIManager.put( "[style].secondary", "borderColor: #0f8; background: #0f8" );
To have similar behavior as in CSS, first the rule without type is applied, then the rule with type. E.g. setting style class to "foo" on a
JButton
uses rules from UI default keys "[style].foo" and "[style]Button.foo".Components
JComponent
Value typeString
,String[]
orList
<String>- Since:
- 2
- 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
andJTextComponent
Value typeInteger
- See Also:
- Constant Field Values
-
MINIMUM_HEIGHT
static final java.lang.String MINIMUM_HEIGHT
Specifies minimum height of a component.Component
JButton
andJToggleButton
Value typeInteger
- 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
andJPasswordField
Value typeBoolean
- 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
andJToggleButton
Value typeString
orColor
orColor
[2]
Allowed ValuesOUTLINE_ERROR
,OUTLINE_WARNING
, any color (typeColor
) or an array of two colors (typeColor
[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 typePredicate
<javax.swing.JComponent>- See Also:
- Constant Field Values
-
COMPONENT_TITLE_BAR_CAPTION
static final java.lang.String COMPONENT_TITLE_BAR_CAPTION
Specifies whether a component shown in a window title bar area should behave as caption (left-click allows moving window, right-click shows window system menu). The caption component does not receive mouse pressed/released/clicked/dragged events, but it gets mouse entered/exited/moved events.Since 3.4, this client property also supports using a function that can check whether a given location in the component should behave as caption. Useful for components that do not use mouse input on whole component bounds.
Warning:myComponent.putClientProperty( "JComponent.titleBarCaption", (Function<Point, Boolean>) pt -> { // parameter pt contains mouse location (in myComponent coordinates) // return true if the component is not interested in mouse input at the given location // return false if the component wants process mouse input at the given location // return null if the component children should be checked return ...; // check here } );
- This function is invoked often when mouse is moved over window title bar area and should therefore return quickly.
- This function is invoked on 'AWT-Windows' thread (not 'AWT-EventQueue' thread) while processing Windows messages. It must not change any component property or layout because this could cause a dead lock.
Component
JComponent
Value typeBoolean
orFunction
<Point, Boolean>- Since:
- 2.5
- See Also:
- Constant Field Values
-
FULL_WINDOW_CONTENT_BUTTONS_PLACEHOLDER
static final java.lang.String FULL_WINDOW_CONTENT_BUTTONS_PLACEHOLDER
Marks the panel as placeholder for the iconfify/maximize/close buttons in fullWindowContent mode. SeeFULL_WINDOW_CONTENT
.If fullWindowContent mode is enabled, the preferred size of the panel is equal to the size of the iconfify/maximize/close buttons. Otherwise is is
0,0
.You're responsible to layout that panel at the top-left or top-right corner, depending on platform, where the iconfify/maximize/close buttons are located.
Syntax of the value string is:
"win|mac [horizontal|vertical] [zeroInFullScreen] [leftToRight|rightToLeft]"
.The string must start with
"win"
(for Windows or Linux) or with"mac"
(for macOS) and specifies the platform where the placeholder should be used. On macOS, you need the placeholder in the top-left corner, but on Windows/Linux you need it in the top-right corner. So if your application supports fullWindowContent mode on both platforms, you can add two placeholders to your layout and FlatLaf automatically uses only one of them. The other gets size0,0
.Optionally, you can append following options to the value string (separated by space characters):
"horizontal"
- preferred height is zero"vertical"
- preferred width is zero"zeroInFullScreen"
- in full-screen mode on macOS, preferred size is0,0
"leftToRight"
- in right-to-left component orientation, preferred size is0,0
"rightToLeft"
- in left-to-right component orientation, preferred size is0,0
Or add placeholder as first item to the tool bar:JPanel placeholder = new JPanel(); placeholder.putClientProperty( FlatClientProperties.FULL_WINDOW_CONTENT_BUTTONS_PLACEHOLDER, "mac" ); JToolBar toolBar = new JToolBar(); // add tool bar items JPanel toolBarPanel = new JPanel( new BorderLayout() ); toolBarPanel.add( placeholder, BorderLayout.WEST ); toolBarPanel.add( toolBar, BorderLayout.CENTER ); frame.getContentPane().add( toolBarPanel, BorderLayout.NORTH );
If a tabbed pane is located at the top, you can add the placeholder as leading component to that tabbed pane:JPanel placeholder = new JPanel(); placeholder.putClientProperty( FlatClientProperties.FULL_WINDOW_CONTENT_BUTTONS_PLACEHOLDER, "mac" ); JToolBar toolBar = new JToolBar(); toolBar.add( placeholder ); // add tool bar items frame.getContentPane().add( toolBar, BorderLayout.NORTH );
JPanel placeholder = new JPanel(); placeholder.putClientProperty( FlatClientProperties.FULL_WINDOW_CONTENT_BUTTONS_PLACEHOLDER, "mac" ); tabbedPane.putClientProperty( FlatClientProperties.TABBED_PANE_LEADING_COMPONENT, placeholder );
Component
JPanel
Value typeString
- Since:
- 3.4
- See Also:
- Constant Field Values
-
POPUP_BORDER_CORNER_RADIUS
static final java.lang.String POPUP_BORDER_CORNER_RADIUS
Specifies the popup border corner radius if the component is shown in a popup or if the component is the owner of another component that is shown in a popup.Note that this is not available on all platforms since it requires special support. Supported platforms:
- Windows 11: Only two corner radiuses are supported
by the OS:
DWMWCP_ROUND
is 8px andDWMWCP_ROUNDSMALL
is 4px. If this value is1 - 4
, thenDWMWCP_ROUNDSMALL
is used. If it is>= 5
, thenDWMWCP_ROUND
is used. - macOS (10.14 and later): Any corner radius is supported.
JComponent
Value typeInteger
- Since:
- 3.1
- See Also:
- Constant Field Values
- Windows 11: Only two corner radiuses are supported
by the OS:
-
POPUP_ROUNDED_BORDER_WIDTH
static final java.lang.String POPUP_ROUNDED_BORDER_WIDTH
Specifies the popup rounded border width if the component is shown in a popup or if the component is the owner of another component that is shown in a popup.Only used if popup uses rounded border.
Note that this is not available on all platforms since it requires special support. Supported platforms:
- macOS (10.14 and later)
JComponent
Value typeInteger
orFloat
- Since:
- 3.3
- 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 typeBoolean
- 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 typeBoolean
- 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 typeBoolean
- 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 typeBoolean
- See Also:
- Constant Field Values
-
USE_WINDOW_DECORATIONS
static final java.lang.String USE_WINDOW_DECORATIONS
Specifies whether FlatLaf native window decorations should be used forJFrame
orJDialog
.Setting this enables/disables using FlatLaf native window decorations for the window that contains the root pane.
This client property has lower priority than system property
FlatSystemProperties.USE_WINDOW_DECORATIONS
, but higher priority than UI defaultTitlePane.useWindowDecorations
.(requires Window 10)
Component
JRootPane
Value typeBoolean
- Since:
- 1.1.1
- 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 window title pane if window decorations are enabled.Setting this enables/disables embedding for the window that contains the root pane.
This client property has lower priority than system property
FlatSystemProperties.MENUBAR_EMBEDDED
, but higher priority than UI defaultTitlePane.menuBarEmbedded
.(requires Window 10)
Component
JRootPane
Value typeBoolean
- See Also:
- Constant Field Values
-
FULL_WINDOW_CONTENT
static final java.lang.String FULL_WINDOW_CONTENT
Specifies whether the content pane (and the glass pane) should be extended into the window title bar area (requires enabled window decorations). Default isfalse
.On macOS, use client property
apple.awt.fullWindowContent
(see macOS Full window content).Setting this enables/disables full window content for the
JFrame
orJDialog
that contains the root pane.If
true
, the content pane (and the glass pane) is extended into the title bar area. The window icon and title are hidden. Only the iconfify/maximize/close buttons stay visible in the upper right corner (and overlap the content pane).The user can left-click-and-drag on the title bar area to move the window, except when clicking on a component that processes mouse events (e.g. buttons or menus).
Component
JRootPane
Value typeBoolean
- Since:
- 3.4
- See Also:
- Constant Field Values
-
FULL_WINDOW_CONTENT_BUTTONS_BOUNDS
static final java.lang.String FULL_WINDOW_CONTENT_BUTTONS_BOUNDS
Contains the current bounds of the iconfify/maximize/close buttons (in root pane coordinates) if fullWindowContent mode is enabled. Otherwise its value isnull
.Note: Do not set this client property. It is set by FlatLaf.
Component
JRootPane
Value typeRectangle
- Since:
- 3.4
- See Also:
- Constant Field Values
-
TITLE_BAR_SHOW_ICON
static final java.lang.String TITLE_BAR_SHOW_ICON
Specifies whether the window icon should be shown in the window title bar (requires enabled window decorations). Default is UI propertyTitlePane.showIcon
.Setting this shows/hides the windows icon for the
JFrame
orJDialog
that contains the root pane.This client property has higher priority than UI default
TitlePane.showIcon
.(requires Window 10)
Component
JRootPane
Value typeBoolean
- Since:
- 2
- See Also:
- Constant Field Values
-
TITLE_BAR_SHOW_TITLE
static final java.lang.String TITLE_BAR_SHOW_TITLE
Specifies whether the window title should be shown in the window title bar (requires enabled window decorations). Default istrue
.Setting this shows/hides the windows title for the
JFrame
orJDialog
that contains the root pane.Component
JRootPane
Value typeBoolean
- Since:
- 3
- See Also:
- Constant Field Values
-
TITLE_BAR_SHOW_ICONIFFY
static final java.lang.String TITLE_BAR_SHOW_ICONIFFY
Specifies whether the "iconify" button should be shown in the window title bar (requires enabled window decorations). Default istrue
.Setting this shows/hides the "iconify" button for the
JFrame
that contains the root pane.Component
JRootPane
Value typeBoolean
- Since:
- 3
- See Also:
- Constant Field Values
-
TITLE_BAR_SHOW_MAXIMIZE
static final java.lang.String TITLE_BAR_SHOW_MAXIMIZE
Specifies whether the "maximize/restore" button should be shown in the window title bar (requires enabled window decorations). Default istrue
.Setting this shows/hides the "maximize/restore" button for the
JFrame
that contains the root pane.Component
JRootPane
Value typeBoolean
- Since:
- 3
- See Also:
- Constant Field Values
-
TITLE_BAR_SHOW_CLOSE
static final java.lang.String TITLE_BAR_SHOW_CLOSE
Specifies whether the "close" button should be shown in the window title bar (requires enabled window decorations). Default istrue
.Setting this shows/hides the "close" button for the
JFrame
orJDialog
that contains the root pane.Component
JRootPane
Value typeBoolean
- Since:
- 3
- See Also:
- Constant Field Values
-
TITLE_BAR_BACKGROUND
static final java.lang.String TITLE_BAR_BACKGROUND
Background color of window title bar (requires enabled window decorations).(requires Window 10)
Component
JRootPane
Value typeColor
- Since:
- 1.1.2
- See Also:
- Constant Field Values
-
TITLE_BAR_FOREGROUND
static final java.lang.String TITLE_BAR_FOREGROUND
Foreground color of window title bar (requires enabled window decorations).(requires Window 10)
Component
JRootPane
Value typeColor
- Since:
- 1.1.2
- See Also:
- Constant Field Values
-
GLASS_PANE_FULL_HEIGHT
static final java.lang.String GLASS_PANE_FULL_HEIGHT
Specifies whether the glass pane should have full height and overlap the title bar, if FlatLaf window decorations are enabled. Default isfalse
.Component
JRootPane
Value typeBoolean
- Since:
- 3.1
- See Also:
- Constant Field Values
-
WINDOW_STYLE
static final java.lang.String WINDOW_STYLE
Specifies the style of the window title bar. Besides the default title bar style, you can use a Utility-style title bar, which is smaller than the default title bar.On Windows 10/11, this requires FlatLaf window decorations. On macOS, Java supports this out of the box.
Note that this client property must be set before the window becomes displayable. Otherwise, an
IllegalComponentStateException
is thrown.Component
JRootPane
Value typeString
Allowed ValuesWINDOW_STYLE_SMALL
- Since:
- 3.2
- See Also:
- Constant Field Values
-
WINDOW_STYLE_SMALL
static final java.lang.String WINDOW_STYLE_SMALL
The window has Utility-style title bar, which is smaller than default title bar.This is the same as using
Window.setType(java.awt.Window.Type)
(Window.Type.UTILITY
).- Since:
- 3.2
- See Also:
WINDOW_STYLE
, 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
orJScrollPane
Value typeBoolean
- 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 typeBoolean
- See Also:
- Constant Field Values
-
SPLIT_PANE_EXPANDABLE_SIDE
static final java.lang.String SPLIT_PANE_EXPANDABLE_SIDE
Specifies what side of the spilt pane is allowed to expand via one-touch expanding arrow buttons. Requires that one-touch expanding is enabled withJSplitPane.setOneTouchExpandable(boolean)
.Component
JSplitPane
Value typeString
Allowed ValuesSPLIT_PANE_EXPANDABLE_SIDE_LEFT
orSPLIT_PANE_EXPANDABLE_SIDE_RIGHT
- Since:
- 2.2
- See Also:
- Constant Field Values
-
SPLIT_PANE_EXPANDABLE_SIDE_LEFT
static final java.lang.String SPLIT_PANE_EXPANDABLE_SIDE_LEFT
Allow expanding only left/top side of the split pane.- Since:
- 2.2
- See Also:
SPLIT_PANE_EXPANDABLE_SIDE
, Constant Field Values
-
SPLIT_PANE_EXPANDABLE_SIDE_RIGHT
static final java.lang.String SPLIT_PANE_EXPANDABLE_SIDE_RIGHT
Allow expanding only right/bottom side of the split pane.- Since:
- 2.2
- See Also:
SPLIT_PANE_EXPANDABLE_SIDE
, Constant Field Values
-
TABBED_PANE_TAB_TYPE
static final java.lang.String TABBED_PANE_TAB_TYPE
Specifies type of the selected tab.Component
JTabbedPane
Value typeString
Allowed ValuesTABBED_PANE_TAB_TYPE_UNDERLINED
orTABBED_PANE_TAB_TYPE_CARD
- Since:
- 2
- See Also:
- Constant Field Values
-
TABBED_PANE_TAB_TYPE_UNDERLINED
static final java.lang.String TABBED_PANE_TAB_TYPE_UNDERLINED
Paint the selected tab underlined.- Since:
- 2
- See Also:
TABBED_PANE_TAB_TYPE
, Constant Field Values
-
TABBED_PANE_TAB_TYPE_CARD
static final java.lang.String TABBED_PANE_TAB_TYPE_CARD
Paint the selected tab as card.- Since:
- 2
- See Also:
TABBED_PANE_TAB_TYPE
, 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 typeBoolean
- 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 typeBoolean
- 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 typeBoolean
- 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 typeBoolean
- 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 (seeJTabbedPane.setComponentAt(int, java.awt.Component)
)
Value typeInteger
- 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 (seeJTabbedPane.setComponentAt(int, java.awt.Component)
)
Value typeInteger
- See Also:
- Constant Field Values
-
TABBED_PANE_TAB_HEIGHT
static final java.lang.String TABBED_PANE_TAB_HEIGHT
Specifies the minimum height of a tab.Component
JTabbedPane
Value typeInteger
- See Also:
TABBED_PANE_TAB_INSETS
, 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 (seeJTabbedPane.setComponentAt(int, java.awt.Component)
)
Value typeInsets
- 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 typeInsets
- 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 totrue
on a tabbed pane component, all tabs in that tabbed pane are closable. To make individual tabs closable, set it totrue
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 (seeJTabbedPane.setComponentAt(int, java.awt.Component)
)
Value typeBoolean
-
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 (seeJTabbedPane.setComponentAt(int, java.awt.Component)
)
Value typeString
- 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:
Or use amyTabbedPane.putClientProperty( "JTabbedPane.tabCloseCallback", (IntConsumer) tabIndex -> { // close tab here } );
BiConsumer
<javax.swing.JTabbedPane, Integer> that receives the tabbed pane and the tab index as parameters:
If you need to check whether a modifier key (e.g. Alt or Shift) was pressed while the user clicked the tab close button, usemyTabbedPane.putClientProperty( "JTabbedPane.tabCloseCallback", (BiConsumer<JTabbedPane, Integer>) (tabbedPane, tabIndex) -> { // close tab here } );
EventQueue.getCurrentEvent()
to get current event, check whether it is aMouseEvent
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 (seeJTabbedPane.setComponentAt(int, java.awt.Component)
)
Value typeIntConsumer
orBiConsumer
<javax.swing.JTabbedPane, Integer>- See Also:
TABBED_PANE_TAB_CLOSABLE
, Constant Field Values
-
TABBED_PANE_TABS_POPUP_POLICY
static final java.lang.String TABBED_PANE_TABS_POPUP_POLICY
Specifies the display policy for the "more tabs" button, which shows a popup menu with the (partly) hidden tabs.Component
JTabbedPane
Value typeString
Allowed ValuesTABBED_PANE_POLICY_NEVER
orTABBED_PANE_POLICY_AS_NEEDED
- See Also:
- Constant Field Values
-
TABBED_PANE_SCROLL_BUTTONS_POLICY
static final java.lang.String TABBED_PANE_SCROLL_BUTTONS_POLICY
Specifies the display policy for the forward/backward scroll arrow buttons.Component
JTabbedPane
Value typeString
Allowed ValuesTABBED_PANE_POLICY_NEVER
,TABBED_PANE_POLICY_AS_NEEDED
orTABBED_PANE_POLICY_AS_NEEDED_SINGLE
- See Also:
- Constant Field Values
-
TABBED_PANE_POLICY_NEVER
static final java.lang.String TABBED_PANE_POLICY_NEVER
Display never.
-
TABBED_PANE_POLICY_AS_NEEDED
static final java.lang.String TABBED_PANE_POLICY_AS_NEEDED
Display only when needed.If used for
TABBED_PANE_SCROLL_BUTTONS_POLICY
, both scroll arrow buttons are either shown or hidden. Buttons are disabled if scrolling in that direction is not applicable.
-
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.
-
TABBED_PANE_SCROLL_BUTTONS_PLACEMENT
static final java.lang.String TABBED_PANE_SCROLL_BUTTONS_PLACEMENT
Specifies the placement of the forward/backward scroll arrow buttons.Component
JTabbedPane
Value typeString
Allowed ValuesTABBED_PANE_PLACEMENT_BOTH
orTABBED_PANE_PLACEMENT_TRAILING
- See Also:
- 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.
-
TABBED_PANE_PLACEMENT_TRAILING
static final java.lang.String TABBED_PANE_PLACEMENT_TRAILING
The forward/backward scroll arrow buttons are placed on the trailing side of the tab area.
-
TABBED_PANE_TAB_AREA_ALIGNMENT
static final java.lang.String TABBED_PANE_TAB_AREA_ALIGNMENT
Specifies the alignment of the tab area.Component
JTabbedPane
Value typeInteger
orString
Allowed ValuesSwingConstants.LEADING
(default),SwingConstants.TRAILING
,SwingConstants.CENTER
,TABBED_PANE_ALIGN_LEADING
(default),TABBED_PANE_ALIGN_TRAILING
,TABBED_PANE_ALIGN_CENTER
orTABBED_PANE_ALIGN_FILL
- See Also:
- 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 (seeJTabbedPane.setComponentAt(int, java.awt.Component)
)
Value typeInteger
orString
Allowed ValuesSwingConstants.LEADING
,SwingConstants.TRAILING
,SwingConstants.CENTER
(default),TABBED_PANE_ALIGN_LEADING
,TABBED_PANE_ALIGN_TRAILING
orTABBED_PANE_ALIGN_CENTER
(default)- See Also:
- Constant Field Values
-
TABBED_PANE_ALIGN_LEADING
static final java.lang.String TABBED_PANE_ALIGN_LEADING
Align to the leading edge.
-
TABBED_PANE_ALIGN_TRAILING
static final java.lang.String TABBED_PANE_ALIGN_TRAILING
Align to the trailing edge.
-
TABBED_PANE_ALIGN_CENTER
static final java.lang.String TABBED_PANE_ALIGN_CENTER
Align to center.
-
TABBED_PANE_ALIGN_FILL
static final java.lang.String TABBED_PANE_ALIGN_FILL
Stretch to fill all available space.
-
TABBED_PANE_TAB_WIDTH_MODE
static final java.lang.String TABBED_PANE_TAB_WIDTH_MODE
Specifies how the tabs should be sized.Component
JTabbedPane
Value typeString
Allowed ValuesTABBED_PANE_TAB_WIDTH_MODE_PREFERRED
(default),TABBED_PANE_TAB_WIDTH_MODE_EQUAL
orTABBED_PANE_TAB_WIDTH_MODE_COMPACT
- See Also:
- Constant Field Values
-
TABBED_PANE_TAB_WIDTH_MODE_PREFERRED
static final java.lang.String TABBED_PANE_TAB_WIDTH_MODE_PREFERRED
Tab width is adjusted to tab icon and title.- See Also:
TABBED_PANE_TAB_WIDTH_MODE
, Constant Field Values
-
TABBED_PANE_TAB_WIDTH_MODE_EQUAL
static final java.lang.String TABBED_PANE_TAB_WIDTH_MODE_EQUAL
All tabs in a tabbed pane has same width.- See Also:
TABBED_PANE_TAB_WIDTH_MODE
, 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 typeInteger
Allowed ValuesSwingConstants.LEADING
(default),SwingConstants.TRAILING
,SwingConstants.TOP
orSwingConstants.BOTTOM
- See Also:
- Constant Field Values
-
TABBED_PANE_TAB_ROTATION
static final java.lang.String TABBED_PANE_TAB_ROTATION
Specifies the rotation of the tabs (title, icon, etc.).Component
JTabbedPane
Value typeInteger
orString
Allowed ValuesSwingConstants.LEFT
,SwingConstants.RIGHT
,TABBED_PANE_TAB_ROTATION_NONE
(default),TABBED_PANE_TAB_ROTATION_AUTO
,TABBED_PANE_TAB_ROTATION_LEFT
orTABBED_PANE_TAB_ROTATION_RIGHT
- Since:
- 3.3
- See Also:
- Constant Field Values
-
TABBED_PANE_TAB_ROTATION_NONE
static final java.lang.String TABBED_PANE_TAB_ROTATION_NONE
Tabs are not rotated.- Since:
- 3.3
- See Also:
TABBED_PANE_TAB_ROTATION
, Constant Field Values
-
TABBED_PANE_TAB_ROTATION_AUTO
static final java.lang.String TABBED_PANE_TAB_ROTATION_AUTO
Tabs are rotated depending on tab placement.For top and bottom tab placement, the tabs are not rotated.
For left tab placement, the tabs are rotated counter-clockwise.
For right tab placement, the tabs are rotated clockwise.- Since:
- 3.3
- See Also:
TABBED_PANE_TAB_ROTATION
, Constant Field Values
-
TABBED_PANE_TAB_ROTATION_LEFT
static final java.lang.String TABBED_PANE_TAB_ROTATION_LEFT
Tabs are rotated counter-clockwise.- Since:
- 3.3
- See Also:
TABBED_PANE_TAB_ROTATION
, Constant Field Values
-
TABBED_PANE_TAB_ROTATION_RIGHT
static final java.lang.String TABBED_PANE_TAB_ROTATION_RIGHT
Tabs are rotated clockwise.- Since:
- 3.3
- See Also:
TABBED_PANE_TAB_ROTATION
, 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 laid out component size will be the preferred component width and the tab area height.
For left and right tab placement, the laid out component size will be the tab area width and the preferred component height.Component
JTabbedPane
Value typeComponent
- 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 laid 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 laid out component size will be the tab area width and the available vertical space (minimum is preferred component height).Component
JTabbedPane
Value typeComponent
- See Also:
- Constant Field Values
-
SELECT_ALL_ON_FOCUS_POLICY
static final java.lang.String SELECT_ALL_ON_FOCUS_POLICY
Specifies whether all text is selected when the text component gains focus.Component
JTextField
(and subclasses)
Value typeString
Allowed ValuesSELECT_ALL_ON_FOCUS_POLICY_NEVER
,SELECT_ALL_ON_FOCUS_POLICY_ONCE
(default) orSELECT_ALL_ON_FOCUS_POLICY_ALWAYS
- See Also:
- Constant Field Values
-
SELECT_ALL_ON_FOCUS_POLICY_NEVER
static final java.lang.String SELECT_ALL_ON_FOCUS_POLICY_NEVER
Never select all text when the text component gains focus.- See Also:
SELECT_ALL_ON_FOCUS_POLICY
, 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
-
SELECT_ALL_ON_FOCUS_POLICY_ALWAYS
static final java.lang.String SELECT_ALL_ON_FOCUS_POLICY_ALWAYS
Always select all text when the text component gains focus.- 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) orJComboBox
Value typeString
- See Also:
- Constant Field Values
-
TEXT_FIELD_PADDING
static final java.lang.String TEXT_FIELD_PADDING
Specifies the padding of the text. This changes the location and size of the text view within the component bounds, but does not affect the size of the component.Component
JTextField
(and subclasses)
Value typeInsets
- Since:
- 1.4
- See Also:
- Constant Field Values
-
TEXT_FIELD_LEADING_ICON
static final java.lang.String TEXT_FIELD_LEADING_ICON
Specifies an icon that will be placed at the leading edge of the text field.Component
JTextField
(and subclasses)
Value typeIcon
- Since:
- 2
- See Also:
- Constant Field Values
-
TEXT_FIELD_TRAILING_ICON
static final java.lang.String TEXT_FIELD_TRAILING_ICON
Specifies an icon that will be placed at the trailing edge of the text field.Component
JTextField
(and subclasses)
Value typeIcon
- Since:
- 2
- See Also:
- Constant Field Values
-
TEXT_FIELD_LEADING_COMPONENT
static final java.lang.String TEXT_FIELD_LEADING_COMPONENT
Specifies a component that will be placed at the leading edge of the text field.The component will be positioned inside and aligned to the visible text field border. There is no gap between the visible border and the component. The laid out component size will be the preferred component width and the inner text field height.
The component should be not opaque because the text field border is painted slightly inside the usually visible border in some cases. E.g. when focused (in some themes) or when an outline color is specified (see
OUTLINE
).The component is prepared in the following way:
- Component client property
STYLE_CLASS
is set toinTextField
. - If component is a button or toggle button, client property
BUTTON_TYPE
is set toBUTTON_TYPE_TOOLBAR_BUTTON
and button cursor is set to default cursor (if not set). - If component is a toolbar, client property
STYLE_CLASS
is set toinTextField
on all toolbar children and toolbar cursor is set to default cursor (if not set).
comp.setCursor( Cursor.getDefaultCursor() )
.Styling is used to modify insets/margins and appearance of buttons and toolbars so that they fit nicely into the text field and do not increase text field height. See styles
[style]Button.inTextField
and[style]ToolBar.inTextField
inFlat[Light|Dark]Laf.properties
.Component
JTextField
(and subclasses)
Value typeJComponent
- Since:
- 2
- See Also:
- Constant Field Values
- Component client property
-
TEXT_FIELD_TRAILING_COMPONENT
static final java.lang.String TEXT_FIELD_TRAILING_COMPONENT
Specifies a component that will be placed at the trailing edge of the text field.See
TEXT_FIELD_LEADING_COMPONENT
for details.Component
JTextField
(and subclasses)
Value typeJComponent
- Since:
- 2
- See Also:
- Constant Field Values
-
TEXT_FIELD_SHOW_CLEAR_BUTTON
static final java.lang.String TEXT_FIELD_SHOW_CLEAR_BUTTON
Specifies whether a "clear" (or "cancel") button is shown on the trailing side if the text field is not empty, editable and enabled. Default isfalse
.Component
JTextField
(and subclasses)
Value typeBoolean
- Since:
- 2
- See Also:
- Constant Field Values
-
TEXT_FIELD_CLEAR_CALLBACK
static final java.lang.String TEXT_FIELD_CLEAR_CALLBACK
Specifies the callback that is invoked when a "clear" (or "cancel") button is clicked. If a callback is specified than it is responsible for clearing the text field. Without callback, the text field clears itself.Either use a
Runnable
:
Or use amyTextField.putClientProperty( "JTextField.clearCallback", (Runnable) () -> { // clear field here or cancel search } );
Consumer
<javax.swing.text.JTextComponent> that receives the text field as parameter:myTextField.putClientProperty( "JTextField.clearCallback", (Consumer<JTextComponent>) textField -> { // clear field here or cancel search } );
Component
JTextField
(and subclasses)
Value typeRunnable
orConsumer
<javax.swing.text.JTextComponent>- Since:
- 2
- See Also:
TEXT_FIELD_SHOW_CLEAR_BUTTON
, Constant Field Values
-
TAB_BUTTON_UNDERLINE_PLACEMENT
static final java.lang.String TAB_BUTTON_UNDERLINE_PLACEMENT
Placement of underline if toggle button type isBUTTON_TYPE_TAB
Component
JToggleButton
Value typeInteger
Allowed ValuesSwingConstants.BOTTOM
(default),SwingConstants.TOP
,SwingConstants.LEFT
orSwingConstants.RIGHT
- Since:
- 2.3
- See Also:
- Constant Field Values
-
TAB_BUTTON_UNDERLINE_HEIGHT
static final java.lang.String TAB_BUTTON_UNDERLINE_HEIGHT
Thickness of underline if toggle button type isBUTTON_TYPE_TAB
.Component
JToggleButton
Value typeInteger
- 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 isBUTTON_TYPE_TAB
.Component
JToggleButton
Value typeColor
- 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 isBUTTON_TYPE_TAB
.Component
JToggleButton
Value typeColor
- 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 istrue
.Component
JTree
Value typeBoolean
- See Also:
- Constant Field Values
-
TREE_PAINT_SELECTION
static final java.lang.String TREE_PAINT_SELECTION
Specifies whether tree item selection is painted. Default istrue
. If set tofalse
, then the tree cell renderer is responsible for painting selection.Component
JTree
Value typeBoolean
- See Also:
- Constant Field Values
-
MACOS_WINDOW_BUTTONS_SPACING
static final java.lang.String MACOS_WINDOW_BUTTONS_SPACING
Specifies the spacing around the macOS window close/minimize/zoom buttons. Useful if full window content is enabled.(requires macOS 10.14+ for "medium" spacing and macOS 11+ for "large" spacing, requires Java 17+)
Component
JRootPane
Value typeString
Allowed ValuesMACOS_WINDOW_BUTTONS_SPACING_MEDIUM
orMACOS_WINDOW_BUTTONS_SPACING_LARGE
(requires macOS 11+)- Since:
- 3.4
- See Also:
- Constant Field Values
-
MACOS_WINDOW_BUTTONS_SPACING_MEDIUM
static final java.lang.String MACOS_WINDOW_BUTTONS_SPACING_MEDIUM
Add medium spacing around the macOS window close/minimize/zoom buttons.- Since:
- 3.4
- See Also:
MACOS_WINDOW_BUTTONS_SPACING
, Constant Field Values
-
MACOS_WINDOW_BUTTONS_SPACING_LARGE
static final java.lang.String MACOS_WINDOW_BUTTONS_SPACING_LARGE
Add large spacing around the macOS window close/minimize/zoom buttons.(requires macOS 11+; "medium" is used on older systems)
- Since:
- 3.4
- See Also:
MACOS_WINDOW_BUTTONS_SPACING
, 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 aBoolean
and returns its value. If the client property is not set, or not aBoolean
, 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.
-
clientProperty
static <T> T clientProperty(javax.swing.JComponent c, java.lang.String key, T defaultValue, java.lang.Class<T> type)
Returns the value of the specified client property if it is an instance of the specified type. Otherwise, defaultValue is returned.- Since:
- 2
-
-