I am writing an applet which contains a panel (PanelCondition) with a java.awt.choice dropdown. http://docs.oracle.com/javase/7/docs/api/java/awt/Choice.html
public class PanelCondition extends Panel
{
Choice choiceCond = new Choice();
public PanelCondition(bool isGood)
{
setCond(isGood);
}
private void setCond(boolean isGood)
{
condCode = getCondItems(isGood);
this.choiceCond.removeAll();
for (int i=0; i < condCode.length; i++)
{
this.choiceCond.addItem(condCode[i]);
}
this.choiceCond.repaint();
}
...
}
The PanelCondition is included in a java.awt.Frame
public class FrameExample extends Frame
{
PanelCondition cond;
private void setCond(bool isGood)
{
cond = new PanelCondition(isGood)
this.add(orderCond,...)
...
}
}
When the FrameExample.setCond() is called first time (isGood=true), the correct items are added to the dropdownlist. However if I call the setCond() the second time (isGood=false), the dropdownlist items don't have any changes.
I have tried to call this.choiceCond.validate() or this.choiceCond.repaint, but it still doesn't work.