I try to use
replaceComponent
method of
TabSheet
component and it doesn’t work properly.
Components is replaced, but tab captions does not.
When both components is exist last lines of code does not needed. There is was only rearrange of components.
public void replaceComponent(Component oldComponent, Component newComponent) {
...
components.remove(oldComponent);
components.add(newLocation, oldComponent);
components.remove(newComponent);
components.add(oldLocation, newComponent);
...
if (newTab != null) {
// This should always be true
newTab.setCaption(oldCaption);
newTab.setIcon(oldIcon);
}
if (oldTab != null) {
// This should always be true
oldTab.setCaption(newCaption);
oldTab.setIcon(newIcon);
}
Maybe I’m wrong in understanding the purpose of this function?
Thank You for Your attention.