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!