ItsNatButtonGroup htmlGroup = componentMgr.getItsNatButtonGroup(group);
htmlGroup.addButton(inputComp1);
htmlGroup.addButton(inputComp2);
}
ToggleButtonModel dataModel1 = inputComp1.getToggleButtonModel();
ToggleButtonModel dataModel2 = inputComp2.getToggleButtonModel();
ActionListener actListener = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String button;
if (e.getSource() == inputComp1.getToggleButtonModel())
button = "button 1";
else
button = "button 2";
System.out.println("Clicked :" + button);
}
};
dataModel1.addActionListener(actListener);
dataModel2.addActionListener(actListener);
ItemListener itemListener = new ItemListener()
{
public void itemStateChanged(ItemEvent e)
{
String fact;
int state = e.getStateChange();
if (state == ItemEvent.SELECTED)
fact = "selected";
else
fact = "deselected";
fact += " button ";
if (e.getItem() == inputComp1.getToggleButtonModel())
fact += "1";
else
fact += "2";
System.out.println(fact);
}
};
dataModel1.addItemListener(itemListener);
dataModel2.addItemListener(itemListener);
}