Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8720841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:07:21+00:00 2026-06-13T07:07:21+00:00

i have four JRatioButtons inside a ButtonGroup in Java. The two first are enabled

  • 0

i have four JRatioButtons inside a ButtonGroup in Java. The two first are enabled and the other two are disabled. If one specific JRatioButton is selected i need to enable the two disabled JRatioButtons.

Im trying this to find the state of the buttons and enable the disabled ones, apparently i found the ones with the disable state but doesnt change that state.

private void activateButtons() {
    Enumeration<AbstractButton> elements = myButtonGroup.getElements();
    while (elements.hasMoreElements()) {
          AbstractButton button = (AbstractButton)elements.nextElement();
          if (button.isEnabled()) {
            System.out.println("This button is disabled! The text of the button is: '" + button.getText() + "'");
            button.setEnabled(true);
          }
    }
}

Im getting the text of the disabled buttons, but i cant disable them.

Any help? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:07:22+00:00Added an answer on June 13, 2026 at 7:07 am

    I don’t know if you any problems in finding the reference of the radio buttons in the second group or you just cannot disable the radio buttons.

    For the first question, it is simple, you just keep the reference of the radio buttons in the second group.

    For the second question, you need to subclass a JRadioButton because I found you can not simply call disable for an object of radio button.

    The code sample of the sub class would be like this.

    this.editable = editable;
    if (editable) {
        this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        super.enableEvents(Event.MOUSE_DOWN | Event.MOUSE_UP);
    } else {
        this.setCursor(CursorFactory.createUnavailableCursor());
        super.disableEvents(Event.MOUSE_DOWN | Event.MOUSE_UP);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have four activities namely, Demo_tabActivity.java [main activity] Tabhost.java The below two activities are
I have four activities namely, Demo_tabActivity.java [main activity] Tabhost.java The below two activities are
i have four tables user-question contains two columns: questionID, userID, the questions that the
I have four tables. Three of them are tables with one key and they
I have four divs in a row and whichever one you click on, the
I have four or five difference java installations on my Linux computer. I have
I have four input boxes. If the user fills the first box and clicks
I have four html elements that when clicked I want to have a specific
I have four charts in a window. They are displayed one after another in
i have four div in one parent and each contains one image. i want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.