Geertjan's Blog

  • January 20, 2014

Options Window Color Analysis

Geertjan Wielenga
Product Manager

So you're happily using JTattoo in your NetBeans Platform application. However, when you use the darker variations, such as "com.jtattoo.plaf.graphite.GraphiteLookAndFeel", you run into a problem. Though all the colors change as you'd expect... there's still the white background at the top of the Options window, as you can see below. 

That may seem like a small and insignificant problem. However, in the real world, Java and the NetBeans Platform are to be found in air traffic management and air traffic control systems, where the possibility of switching between a "day view" and a "night view", with all the related color updates, is not a "nice to have", but a "must".

So, the pesky white bar at the top of the Options window is a real problem in these real scenarios. A glaring white background is the very last thing you want in the Options window when the traffic controller has switched to "night view".

How to fix it? First, run the application from NetBeans IDE in Debug mode, open the Options window, and then click the orange camera button in the toolbar. Now a snapshot is made of the Options window and rendered in NetBeans IDE, where you can click on anything in the snapshot and see its related properties, such as the name of the panel where that white background is defined:

Then dig into the source code and find that panel. You now find that "Tree.background" is the relevant UIManager color for the white background in the Options window:

private static Color getTabPanelBackground() {
if( isMetal || isNimbus ) {
Color res = UIManager.getColor( "Tree.background" ); //NOI18N
if( null == res )
res = Color.white;
return new Color( res.getRGB() );
return Color.white;

Switch into your @OnStart annotated Runnable and use "Tree.background" as shown below:

public class Startable implements Runnable {
public void run() {
try {
UIManager.put("Tree.background", Color.LIGHT_GRAY);
} catch (ClassNotFoundException ex) {
Logger.getLogger(Startable.class.getName()).log(Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
Logger.getLogger(Startable.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(Startable.class.getName()).log(Level.SEVERE, null, ex);
} catch (UnsupportedLookAndFeelException ex) {
Logger.getLogger(Startable.class.getName()).log(Level.SEVERE, null, ex);

And here's the Options window again, gone is the white background at the top:

Don't like the light gray color I set above? Fine, change it to another color. The point is that you now have control over that color and you also know how to figure out similar problems next time.

Join the discussion

Comments ( 2 )
  • guest Tuesday, January 21, 2014


    I am an innovation consultant from Bangalore India. I will be conducting a workshop for IC5s at Oracle Bangalore tomorrow. One of the modules will be to write a position blog where each participant will write and upload a blog on Oracle Intranet. Hence, I was going through some of the blogs at Oracle site. You seem to be writing a blog *every day*!! How do you manage that? I will be meeting engineers tomorrow who will complain that they don't get any time to do stuff like writing a blog :-) What is your magic wand?



  • Geertjan Tuesday, January 21, 2014

    Well, I get questions from users every day, so I tend to need to answer them every day and sharing answers with the world saves time because next time someone asks the same question, I can point them to my blog. Also, my blog is primarily a way for me to have a repository of solutions, i.e., I often forget something I learned 5 years ago, but now I have a place to go to to find my old answers. Drop me a line at geertjan.wielenga@oracle.com and we can talk more about it, would be happy to help you with your workshops and participate in any way you like. Blogging makes work more fun, too.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.