Hello All,
I have added a LabeledColorWidget onto a JPanel. Depending on which color
map the user chooses, I would like to remove the current widget from the
panel and add another one in its place. I have been using the following code:
public void actionPerformed(ActionEvent e)
{
scaleAllScaleButtonSelect(false);
JRadioButton tempButton = (JRadioButton)e.getSource();
tempButton.setSelected(true);
jPanel1.remove(0);
jPanel1.add(client.getColorWidget(((JRadioButton)e.getSource()).getText()),0);
jPanel1.repaint();
}
However, after I remove the first widget the second widget does not appear
on my panel. I know it is there because if the actionPerformed is called
again, other components will not be removed (at the 0th position of the
panel). Is there something about the widget that I need to know
about? Does anyone have any suggestions?
thanks,
john