Thanks to all for the help.  I use the System LAF which is Motif on Solaris.

Yes, I looked at much of the UI source code. The ButtonUI just extends
ComponentUI which doesn't define any of the settings. Since I couldn't find
many of the settings in the source code, I wrote a little program that
prints out all the UIDefaults, then I sorted them. It is very enlightening.

This solution works perfectly for what I want:
UIManager.put("Button.select", my_color);

Why is   setContentAreaFilled(false)   preferred over   setOpaque(false)
for JButton? Does that apply to other widgets or just JButton?

--
Marie.
~~~~~~~~~~~~~~/\~~~~~~O-O~~~~~~~
A. Marie Alm, Sr. Software Engineer
0-In Design Automation, San Jose, Ca.
"Zero-In"   http://www.0-In.com
Tel: 408.487.3608
~~~~~~~~~~~~~~\/~~~~~~~~~~~~~~~~

"Farwell, Paul" wrote:

> Sorry for not reading your question more carefully...
>
> We have been able to get this sort of effect by making the button
> transparent, allowing it to have the background color of the panel (or
> component) beneath it. We use
>
> btn.setContentAreaFilled(false)
>
> which is the recommended over setOpaque() for buttons.
>
> Also, have you taken a look at the ButtonUI source? I suspect that there
> is
> a UIManager property that controls the 'pressed' color - that is, if
> setContentAreaFilled(false) doesn't work for you.
>

"Wathen, Dave" wrote:

> The painting of the selected state is UI specific.  If you're using
> the metal (cross-platform) LAF you can impact it by e.g.:
>
>     UIManager.out("Button.select", Color.white);
>
> Or you can stop the button having any background (selected or otherwise)
> by using setContentAreaFilled(false) on the button.
>
> Regards
>
> Dave Wathen
> Goldman Sachs Asset Management
> 3rd Floor, Procession House
> 55 Ludgate Hill
> London EC4M 7JN
> +44 (0)20-7774-2998
> Any sufficiently advanced technology is indistinguishable from magic.
> (Arthur C. Clarke)
>
> -----Original Message-----
> From: Marie Alm [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 08, 2001 6:31 PM
> To: Advanced Swing
> Subject: button selected background color
>
> Hello all -
>
> Does anyone know if (and how) the background color of a JButton
> in its selected state can be changed - I'm trying to get rid of
> the gray. The button just shows text, no icons.
>
> Thanks,
> Marie.
> ~~~~~~~~~~~~~~/\~~~~~~O-O~~~~~~~
> A. Marie Alm, Sr. Software Engineer
> 0-In Design Automation, San Jose, Ca.
> "Zero-In"   http://www.0-In.com
> Tel: 408.487.3608
> ~~~~~~~~~~~~~~\/~~~~~~~~~~~~~~~~
>
> _______________________________________________
> Advanced-swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/advanced-swing

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to