Results 1 to 4 of 4
  1. #1
    AJG
    AJG is offline Member
    Join Date
    Apr 2008
    Posts
    7
    Rep Power
    0

    Default Disable Radio button

    when the user presses on the A radio button i want radio buttons B,C and D to be disabled i used the code:

    Java Code:
            A.addActionListener(new  ActionListener()
            {
                public void actionPerformed(ActionEvent e)
                {
                    B.setEnabled(false);
                    C.setEnabled(false);
                    D.setEnabled(false);
                    answerwrong ++;
                }
            });
    however this isnt working any ideas on how i can get these button to disable

  2. #2
    javaLover90 is offline Member
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Default

    setEnable enables the button to work
    setSelected sets whether the button is selected or not
    are you sure you mean setEnable??

    if you meant setSelected you could add the buttons to a button group and automatically only 1 can be selected
    hope I helped

  3. #3
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Quote Originally Posted by javaLover90 View Post
    setEnable enables the button to work
    setSelected sets whether the button is selected or not
    are you sure you mean setEnable??

    if you meant setSelected you could add the buttons to a button group and automatically only 1 can be selected
    hope I helped
    This post is a little over 3 years old, I doubt that user will ever see it, or will need it anymore.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Non functional radio buttons and messed up array
    By flameofSuzaku in forum New To Java
    Replies: 2
    Last Post: 01-10-2011, 06:38 PM
  2. disable parent window
    By ismailsaleh in forum AWT / Swing
    Replies: 1
    Last Post: 01-08-2008, 12:15 AM
  3. property for radio buttons
    By swapnanair in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 12-03-2007, 09:39 AM
  4. Radio button values are not lose
    By chockalingam in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 12-03-2007, 09:14 AM
  5. Replies: 3
    Last Post: 06-07-2007, 06:52 PM

Posting Permissions

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