Customizing

You can customize the appearance of FlatLaf to some degree by setting UI defaults with:

UIManager.put( "someKey", someValue );

Note: Invoke UIManager.put() always after setting the look and feel with e.g. FlatLightLaf.install() (but before creating the components). Otherwise, the system look and feel is temporary installed before FlatLaf is installed, which may make application startup slower.

This page describes only some of the available settings. More can be found in the properties files here.

General

Rounded or Square Corners

Buttons, toggle buttons, combo boxes and spinners use rounded corners by default. If you prefer square corners use:

UIManager.put( "Button.arc", 0 );
UIManager.put( "Component.arc", 0 );

Button.arc is the corner arc diameter for buttons and toggle buttons (default is 6). Component.arc is the corner arc diameter for other components like combo boxes and spinners (default is 5).

Arrow Type


chevron


triangle

Some components (e.g. combo boxes, spinner, tree, etc) use arrows. FlatLaf supports two types of arrows: chevron and triangle.

To change the arrow type for all arrows in FlatLaf use:

UIManager.put( "Component.arrowType", "chevron" );
or
UIManager.put( "Component.arrowType", "triangle" );

Outer focus border width

Most focusable components in FlatLaf (e.g. button, combo boxes, text fields, etc) indicate the focused state with special borders. The Flat Light and Flat Dark themes use a different color on the existing border (outer focus width is 0). On the other hand the Flat IntelliJ and Flat Darcula themes use outer borders of width 2, which are painted outside of the component.

You can control the width of the outer focus border in all themes with:

UIManager.put( "Component.focusWidth", 1 );

Note: Using outer focus border increases the size of components.

Inner focus border width

In addition to the outer focus border, FlatLaf also supports inner focus borders, which do not increase the size of components. Default inner focus width is 0.

You can change the inner focus width using:

UIManager.put( "Component.innerFocusWidth", 1 );

Show Mnemonics

Mnemonics are hidden by default and made visible when Alt key is pressed. To make mnemonics always visible use:

UIManager.put( "Component.hideMnemonics", false );

Scroll Bar

Show Buttons

The previous/next arrow buttons of scroll bars are hidden by default. To make them visible for all scroll bars in your application use:

UIManager.put( "ScrollBar.showButtons", true );

Or enable them on single components (JScrollPane or JScrollBar) with:

myScrollPane.putClientProperty( "JScrollBar.showButtons", true );
or
myScrollBar.putClientProperty( "JScrollBar.showButtons", true );

Width

The default width of scroll bars is 10. To make them wider (or smaller) use:

UIManager.put( "ScrollBar.width", 16 );