Java/Swing colors - Java color palettes from JFormDesigner

A few days ago I wrote about Java UIManager colors (color keys), and as a quick follow-up to that article, I thought I'd share a few "Java color palette" screen shots from the wonderful JFormDesigner application, which first got me to explore this topic.

The screen shots below come directly from JFormDesigner, and I like them because they show (a) the names of the UIManager colors keys and (b) the actual color corresponding to each color key value.

JFormDesigner System Palette tab

This first screenshot comes from the JFormDesigner "System Palette" tab:

The JFormDesign System Palette (showing Java colors)

There is only one screenshot here, because these are all the colors that are available from the System Palette.

When you access a color from what JFormDesigner refers to as the System Palette, your color code should look like this:

// how to access a Java SystemColor
hostTextField.setBackground(SystemColor.desktop);

JFormDesigner Swing Palette (Java/Swing colors)

Next, here is a collection of JFormDesigner "Swing Palette" screenshots. I've included several screenshots here to help give you an idea of how many colors are available from this palette, and what they look like. It would actually take eight screenshots for me to show you all of the Swing Palette color options, but I hope these first four will be enough to be helpful.

JFormDesigner Swing Palette - Java UIManager color keys (1)

 

JFormDesigner Swing Palette - Java UIManager color keys (2)

 

JFormDesigner Swing Palette - Java UIManager color keys (3)

 

JFormDesigner Swing Palette - Java UIManager color keys (4)

 

Using these colors in your Java application

To use a color from any of these last four screenshots, just use a call to the Java UIManager class, as shown in this example:

headerLabel.setForeground(UIManager.getColor("Label.foreground"));

I hope these screenshots from JFormDesigner help you see some of the Java color palette options that are available to you when creating a Java Swing GUI application. I highly recommend getting colors from these palettes -- as opposed to just creating your own RGB colors ad-hoc -- to help keep the look and feel of your Java application consistent.

Last but not least, for more information on UIManager colors, visit our Java UIManager color keys tutorial.