-7

I want to set my JButton enabled only when I check one radiobutton in my radiobutton group. How can I do that?

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
Ivan Aracki
  • 4,861
  • 11
  • 59
  • 73
  • Show us what code you have so far. Do you have a specific question about something that's not working? – Collin Dec 17 '13 at 14:30

1 Answers1

1

Use itemStateChanged event to detect the radio button enabled & do your stuff,

@Override
    public void itemStateChanged(ItemEvent e) {
        if (e.getStateChange() == ItemEvent.SELECTED) {
            yourButton.enabled=true;
        }
        else if (e.getStateChange() == ItemEvent.DESELECTED) {
            yourButton.enabled=false;
        }
    }
Ulaga
  • 863
  • 1
  • 8
  • 17