
Untitled
By: a guest on
Apr 25th, 2012 | syntax:
None | size: 0.47 KB | hits: 9 | expires: Never
removing jRadioButton automatically in java
// bg: buttonGroup
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int count = -1;
for (Enumeration e=bg.getElements(); e.hasMoreElements(); ) {
JRadioButton b = (JRadioButton)e.nextElement();count++;
if (b.getModel() == bg.getSelection()) {
bg.remove(b);
jPanel1.remove(jPanel1.getComponent(count));
}
}
}
jPanel1.revalidate();
jPanel1.repaint();