This is a followup question to my previous one:
Need FileDialog with a file type filter in Java
I've got a JFileChooser (using that instead of a FileDialog so I can have a file type filter) and I've managed to style it pretty decently for our darker color scheme option except for that little panel on the left. I FINALLY figured out that the one on top was the "ToolBar.background" but I have no idea what that one is called.
Help?
alt text http://img151.imageshack.us/img151/6816/filedialog.jpg
I eventually figured out that the name of the property by looking in the source code for the WindowsPlacesBar:
Color bgColor = new Color(UIManager.getColor("ToolBar.shadow").getRGB());
setBackground(bgColor);
I set the ToolBar.shadow though and nothing changed. Further poking around eventually helped me to realize that the XPStyle.subAppName property was overriding anything I put in. I added this piece of code:
JFileChooser chooser = new JFileChooser();
setWindowsPlacesBackground( chooser );
private void setWindowsPlacesBackground( Container con ) {
Component[] jc = con.getComponents();
for( int i = 0; i < jc.length; i++ ) {
Component c = jc[i];
if( c instanceof WindowsPlacesBar ) {
((WindowsPlacesBar) c).putClientProperty("XPStyle.subAppName", null);
return;
}
if( c instanceof Container ) {
setWindowsPlacesBackground( (Container)c );
}
}
}
By unsetting that property, it allowed my colors and schemes to come through. I still feel like there should be a more clean way of unsetting it than iterating through the containers, but I couldn't find it. It did seem like the WindowsPlacesBar was always the first component in the FileChooser. I'm going to leave this open for another day or two just in case somebody else can show me something more "elegant."