Selected toggle button background color

Discussion in 'Java' started by Todd, Aug 28, 2007.

  1. Todd

    Todd Guest

    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, Aug 28, 2007
    #1
    1. Advertising

  2. Todd wrote:
    > 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.

    --

    Knute Johnson
    email s/nospam/knute/
    Knute Johnson, Aug 29, 2007
    #2
    1. Advertising

  3. Todd

    Roedy Green Guest

    On Tue, 28 Aug 2007 12:12:29 -0700, Todd <>
    wrote, quoted or indirectly quoted someone who 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.


    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.

    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Aug 30, 2007
    #3
  4. Todd

    Michael Jung Guest

    Todd <> writes:
    > 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
    Michael Jung, Aug 30, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. fig000
    Replies:
    0
    Views:
    4,527
    fig000
    Sep 6, 2004
  2. Karen Grube
    Replies:
    7
    Views:
    1,248
  3. Replies:
    0
    Views:
    221
  4. newfie912
    Replies:
    2
    Views:
    141
  5. Chris
    Replies:
    14
    Views:
    177
    The Natural Philosopher
    Apr 2, 2009
Loading...

Share This Page