I have a group of jRadioButton
that I created,
each button has an action listener that creates a JTable
in a separate window.
I want that when I press another button, the frame will be cleaned and then the other JTable
to be performed,
ButtonGroup group = new ButtonGroup();
JRadioButton[] jRadioButton = new JRadioButton[5];
for (int i = 0; i < 5; i++) {
jRadioButton[i] = new JRadioButton("machine "+i);
jRadioButton[i].setBounds(x, y, width, height);// x, y, width, height are place parameters
group.add(jRadioButton[i]);
frame.getContentPane().add(jRadioButton[i]);
frame.update(frame.getGraphics());//update the frame and add the buttons
}
let's say, I pressed machine 1
and a table popped up in a different window, now when I press machine 2
and a different table will pop up I want to clear the new window before the second table is shown.
So my question is, is it possible to clean a window and if yes how?