replaceComponent vs setSecondComponent

Hi,

Is there a difference between using replaceComponent(…) and setSecondComponent(…) for split panel? It seems to me that the replaceComponent(…) calls back the setSecondComponent(…). Which one should I use?

Thanks.

The implementation of replaceComponent looks as follows:

    public void replaceComponent(Component oldComponent, Component newComponent) {
        if (oldComponent == firstComponent) {
            setFirstComponent(newComponent);
        } else if (oldComponent == secondComponent) {
            setSecondComponent(newComponent);
        }
        requestRepaint();
    }

That should explain the difference :slight_smile:

-Henri

Hi,

Does that mean if I am certain that I want to replace the second component, I can directly use setSecondComponent(…) without having to use replaceComponent(…) ?

That’s correct.

Thanks, Henri!