Split setOrientation

How can I use setOrientation of split form java code ? follow code doesn’t work

public void onOrientaClick() {
        if (split.getOrientation()==ORIENTATION_HORIZONTAL )

I fear you cannot change the orientation once the component has been created the first time.

You can see this for yourself by inspecting the setter’s source code:

    public void setOrientation(int orientation) {
        this.orientation = orientation;

        if (component == null) {

here you’ll notice the component == null check, that means that the underlying Vaadin component (two different ones for horizontal and vertical orientations) is created only the first time this method is called.

If you really want to achieve this, you must create the layout programmatically in code (starting from the splitpanel and going deep). When the user switches the orientation, you’ll need to destroy everything and recreate and initialise the new controls.


1 Like