<Swing Dev> Background/Foreground colors and Gtk Look and Feel

Kirill Kirichenko Kirill.Kirichenko at Sun.COM
Thu Jan 22 11:12:52 UTC 2009


Hi Omar
Sorry for delay from out side.
I'm a responsible engineer for GTK L&F.


Omair Majid wrote:
> I have noticed a few issues in the Gtk Look and Feel and would like to 
> know what the correct behaviour should be. The attached program shows a 
> few of my concerns.
> 
> 1) For each of the components, setForeground(color) and/or 
> setBackground(color) assignments are randomly ignored. Is this the 
> expected behaviour? I can understand that using the native look and 
> feel, the feel is exactly preserved and the programmer's preferences are 
> ignored. But there doesn't seem to be any consistency - some components 
> accept the color changes, some silently ignore it. Is there a list 
> showing whether setForeground() and setBackground() is ignored for each 
> swing component with the gtk look and feel?
Generally GTK L&F leverages theme settings for colors, indents and 
fonts. And you shouldn't be able to change them using standard swing API 
when GTK L&F is active. Sometimes this does work but you shouldn't use 
this feature. This is the policy for GTK L&F. Actually the have been 
similar requests and I tried to resolve the issue. The thing is GTK 
itself doesn't allow changing colors freely for all components it just 
uses the theme settings.


> 2) The behaviour varies across jdk6 and openjdk6. For example, the 
> closed-source jdk6 respects 
> JTextPane.setBackground(UIManager.getColor("Panel.background")) but 
> openjdk6 ignores it. In situations like this, what is the correct 
> behaviour? Should I attempt to patch openjdk6 to behave more like closed 
> source jdk6?
It may happen because the codebases slightly different. I haven't 
applied all fixes to openjdk6 which I have to jdk6.

Hope that helps.



More information about the swing-dev mailing list