Swing Appearance

We have collected a few tweaks on this page that come in handy if you want to make your Swing application look a bit more modern than it does by default.

Font of Metal Look and Feel

The default font of the Metal Look&Feel has a bold face and looks pretty ugly on most platforms. There is an easy fix which will make Swing use plain style. This call needs to be made during application initialization:

UIManager.put("swing.boldMetal", Boolean.FALSE);

JSplitPane Borders

JSplitPane components will have be default a pretty ugly border. If you want to get rid of it, replace it by an empty border:

UIManager.put("SplitPaneDivider.border", new BasicBorders.MarginBorder());
JSplitPane pane = new JSplitPane();
pane.setBorder(new BorderFactory.createEmptyBorder(0, 0, 0, 0));

JTree Line Style

The style of the lines drawn by JTree can be configured through a property. See How to Use Trees for details:

JTree tree = new JTree();
tree.putClientProperty("JTree.lineStyle", "Angled");

Classloader for Look and Feels

Look&Feel objects are created through reflection, so it is sometime desirable to have the UIManager use a custom class loader:

UIManager.put("ClassLoader", MyClassLoader.getInstance());