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.

-----Original Message-----
From: Marie Alm [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 08, 2001 8:59 PM
To: Farwell, Paul; Advanced Swing
Subject: Re: button *selected* background color


Thanks but that sets the background of the button in its resting/un-selected
state.

As I said, I'm looking for a way to set the background color when the button
is pressed (selected). When the button is pressed, its background color
changes to some shade of gray. That is the background color I'm talking
about.

If there were a setSelectionBackground() method for AbstractButton as there
is
for  table and list then that would do the trick. However, I can find no
such
method for button.

Is there some way I can set a model to do what I want?

--
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:

> If JComponent.setBackground(Color) doesn't work, you might try setting the
> "Button.background" UIManager property.
>
> Hope that helps,
>
> pf
>
> -----Original Message-----
> From: Marie Alm [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 08, 2001 1: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

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

Reply via email to