In the code fragment below I want to remove a control and then add another to a panel. However, all that happens is that the original control first disappears with the second control not appearing. What am I doing wrong and/or how else can I solve this problem when I want to change controls in a panel? (This is a simplified version of my actual problem of switching panels in the center of a BorderLayout).
Code:
add(one, "Center"
;
...
switch(number) {
case 1:
changePanel.remove(two);
changePanel.add(one);
break;
case 2:
changePanel.remove(one);
changePanel.add(two);
break;
}
...
Many thanks in advance
Kevin
Code:
add(one, "Center"
...
switch(number) {
case 1:
changePanel.remove(two);
changePanel.add(one);
break;
case 2:
changePanel.remove(one);
changePanel.add(two);
break;
}
...
Many thanks in advance
Kevin