Java Radio Buttons

Discussion in 'Java' started by bwilde@gmail.com, Jun 30, 2005.

  1. Guest

    Hello,

    I am creating a GUI in Java and would like to make buttons that behave
    like radio buttons but look like regular JButtons. That is, I would
    like for there to be a button group of three rectangular buttons, with
    one of them always selected (and displayed differently as the other
    to). When another button is clicked, I would like to unselect the
    previous one and select the current one.

    The closest thing that I have seen to do this is to play around with
    the icons that are used for radio buttons (although I don't think that
    java lets me add new text to these images). It seems like there should
    be a simpler way of doing this, though.

    Any thoughts?

    Thanks.
     
    , Jun 30, 2005
    #1
    1. Advertisements

  2. Lee Weiner Guest

    In article <>,
    wrote:
    >Hello,
    >
    >I am creating a GUI in Java and would like to make buttons that behave
    >like radio buttons but look like regular JButtons. That is, I would
    >like for there to be a button group of three rectangular buttons, with
    >one of them always selected (and displayed differently as the other
    >to). When another button is clicked, I would like to unselect the
    >previous one and select the current one.
    >
    >The closest thing that I have seen to do this is to play around with
    >the icons that are used for radio buttons (although I don't think that
    >java lets me add new text to these images). It seems like there should
    >be a simpler way of doing this, though.



    There is. If you use JToggleButtons and add them to a ButtonGroup, they will
    look like JButtons and act like JRadioButtons.

    Lee Weiner
    lee AT leeweiner DOT org
     
    Lee Weiner, Jun 30, 2005
    #2
    1. Advertisements

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. Akin Seigmund Walter-Johnson III

    Help Data bindings with Radio Buttons

    Akin Seigmund Walter-Johnson III, Feb 26, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    467
    Akin Seigmund Walter-Johnson III
    Feb 26, 2004
  2. Bisser Milanov
    Replies:
    2
    Views:
    604
    Bisser Milanov
    Jun 26, 2003
  3. Marcelo

    Refreshing radio buttons selections

    Marcelo, Oct 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    444
    Marcelo
    Oct 16, 2003
  4. Scott D Johnson
    Replies:
    1
    Views:
    1,377
    Scott D Johnson
    Sep 27, 2006
  5. Jan C. Faerber
    Replies:
    0
    Views:
    780
    Jan C. Faerber
    Jun 30, 2009
  6. Hiten
    Replies:
    1
    Views:
    945
    Vidar Petursson
    May 26, 2004
  7. Dr. Leff
    Replies:
    3
    Views:
    542
    David Mark
    Oct 15, 2007
  8. Dr. Leff
    Replies:
    3
    Views:
    459
    David Mark
    Oct 15, 2007
Loading...