Results 1 to 4 of 4

Thread: JRadioButton's not being clicked when clicked--?

  1. #1

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Resolved JRadioButton's not being clicked when clicked--?

    I have a JMenu with some radio buttons...For some reason, when I click the stupid things, they won't do anything...and by that, I mean they want change their state to being clicked(as in the circle being filled)..It's like they are disabled...I'll post the snippets of code with them in it:

    Code:
    	JMenu formatMenu = new JMenu("Format");
    		ButtonGroup bg = new ButtonGroup();	
    		rb0 = new JRadioButton("###",false);
    		rb0.addActionListener(this);
    		rb2 = new JRadioButton("###.##",true);	
    		rb2.addActionListener(this);
    		rb4 = new JRadioButton("###.####",false);
    		rb4.addActionListener(this);	
    		rb6 = new JRadioButton("###.######",false);
    		rb6.addActionListener(this);
    		
    		bg.add(rb0);
    		bg.add(rb2);
    		bg.add(rb4);
    		bg.add(rb6);
    		formatMenu.add(rb0);
    		formatMenu.add(rb2);
    		formatMenu.add(rb4);
    		formatMenu.add(rb6);
    Why would I not be able to click these buttons?


    <Moderator added green check mark>
    Last edited by NoteMe; Feb 21st, 2005 at 09:17 AM.

  2. #2

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: JRadioButton's not being clicked when clicked--?

    I can post the whole thing if you would like ?

  3. #3
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: JRadioButton's not being clicked when clicked--?

    Try adding a JRadioButtonMenuItem to the JMenu instead of adding a JRadioButton

  4. #4

    Thread Starter
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: JRadioButton's not being clicked when clicked--?

    Wow! That worked; I never knew such a thing existed...Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width