Changing the Titlebar Colour
So you want to change the titlebar colour of, say, a JInternalFrame. Sounds
simple huh? Well, maybe I'm particularly slow, but it took me quite some time
to work out exactly how to do this. In the hope that I can save someone else
some time, I outline what I discovered below.
First thing you'll need to know about is the javax.swing.UIManager.
The UIManager keeps track of the current look and feel.
The next important piece of information is that there are a bunch of properties that can be set for the Swing Look and Feel. In our case with the JInternalFrame, the interesting properties are:
Inside your JInternalFrame constructor, you'll want to set these colours to
your desired values using a call like:
UIManager.put("InternalFrame.activeTitleBackground", new ColorUIResource(Color.RED));
You'll then need some code, again in the JInternalFrame constructor, to set the
UI for the JInternalFrame:
javax.swing.plaf.basic.BasicInternalFrameUI ui = new javax.swing.plaf.basic.BasicInternalFrameUI(this);