Selected toggle button background color

T

Todd

Hello all,

I have searched this newsgroup for the answer as to how to change the
toggle button background color when it has been selected with no
viable results. By viable, I mean responses that worked when I
implemented them.

Prior responses are:

August 23, 2002: UIManager.put("ToggleButton.select", new
ColorUIResource(color));
August 6, 2004: UIManager.put("ToggleButton.select", Color.green);


If these are other ways of changing the selected (or activated)
background on a toggle button, I would love to know about them.

Thanks in advance for you help,
Todd
 
K

Knute Johnson

Todd said:
Hello all,

I have searched this newsgroup for the answer as to how to change the
toggle button background color when it has been selected with no
viable results. By viable, I mean responses that worked when I
implemented them.

Prior responses are:

August 23, 2002: UIManager.put("ToggleButton.select", new
ColorUIResource(color));
August 6, 2004: UIManager.put("ToggleButton.select", Color.green);


If these are other ways of changing the selected (or activated)
background on a toggle button, I would love to know about them.

Thanks in advance for you help,
Todd

Todd:

That's pretty much what I would have tried, and I did, but it doesn't
work as you already know. It appears that it changes the value in the
defaults but the color doesn't change. I guess I don't know how to do
it, sorry.

I did try to change the UIDefaults of the current LookAndFeel with the
same results.
 
R

Roedy Green

I have searched this newsgroup for the answer as to how to change the
toggle button background color when it has been selected with no
viable results. By viable, I mean responses that worked when I
implemented them.

You can use an icon of various colours. See
http://mindprod.com/jgloss/jbutton.html
This works fine. You can have variations for rollover, selected,
hovered, pressed etc etc. I have used this for years, so I know it
works.
 
M

Michael Jung

Todd said:
I have searched this newsgroup for the answer as to how to change the
toggle button background color when it has been selected with no
viable results. By viable, I mean responses that worked when I
implemented them.
Prior responses are:
August 23, 2002: UIManager.put("ToggleButton.select", new
ColorUIResource(color));
August 6, 2004: UIManager.put("ToggleButton.select", Color.green);

Change the background in your eventlistener. That has the
advantage/disadvantage that it is keyed to a specific button. The above
solutions change them for all.

Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top