Radio buttons

How can I get the sub menu, which is the father of a selected radio buttons?

I have two sets of radio button with the same names, belong to different sub menu (JMenu objects) and I want to know from which sub menu is the chosen radio button.

thanks

[267 byte] By [doron1970a] at [2007-11-27 11:03:39]
# 1

You have a couple of options:

1. Make the JRadioButtons class members, and test for equality in your ActionListener.

if (e.getSource() == radButton1) {}

2. Use JRadioButton.setActionCommand() to set unique Strings to each JRadioButton, and test for those in your ActionListener.

if (e.getActionCommand().equals("Unique String for radButton1")) {}

mbmerrilla at 2007-7-29 12:51:29 > top of Java-index,Desktop,Core GUI APIs...