I have created 5 radioButton group. I want user clear all group in one click. i use java 1.5.
Does any one know how to do it?
public void actionCommandCLEAR() {
timeGroup.setSelected(timeGroup.getSelection(),false);
dateGroup.setSelected(dateGroup.getSelection(),false);
docGroup.setSelected(docGroup.getSelection(),false);
socGroup.setSelected(socGroup.getSelection(),false);
}
timeGroup.clearSelection();
dateGroup.clearSelection();
docGroup.clearSelection();
socGroup.clearSelection();
for java 1.5 we need to code clearSelection ourselves:
void cleartSelection(ButtonGroup bg) {
Enumeration<AbstractButton> e =bg.getElements();
while(e.hasMoreElements()) {
AbstractButton b = e.nextElement();
b.setSelected(false);
}
}
and
clearSelection(timeGroup);