<Swing Dev> Background/Foreground colors and Gtk Look and Feel
Alexander Potochkin
Alexander.Potochkin at Sun.COM
Mon Jun 22 13:46:32 UTC 2009
Hello Gentlemen
The truth is that L&F can completely ignore the background and
foreground properties
see JComponent.setBackground() javadoc:
* It is up to the look and feel to honor this property, some may
* choose to ignore it.
So for reliable implementation I'd recommend to choose another technique
You may be interested in this blog
http://polygoncell.blogspot.com/2008/07/validation-module-for-swing-application.html
Thanks
alexp
> Thus spake Stijn Debruyckere:
>> Hi,
>>
>> Continuing the discussion of Jan 22, 2009, people seem to think there is
>> no need to adapt the foreground/background colors of say a text field.
>> But how about validation? For example, the background of the 'find'
>> text field of Firefox colors red when the text can't be found. As far
>> as I know, this simple yet powerful feature can't be implemented in
>> Swing if one wants to support multiple look&feels, such as GTK or Nimbus
>> (as setBackground is ignored).
>>
>
> The discussion to which you refer is one I started. At that point, no one
> was able to say how it's possible to build complex Swing widgets and get
> the right colors simultaneously, when using LAFs (like GTK) where
> setBackground is ignored. If someone can provide an answer now, I'd be
> grateful for it.
>
More information about the swing-dev
mailing list