Unexpected behaviour in GRIDLAYOUT

I’ve got a realy strange behaviour in a Gridlayout and I have no clue what the cause of this is.
Can you explain it to me?

Here is the Sourcecode

    private void fill_table_pkw()
    {
        gl_container = new GridLayout(4,20);            
    
//        gl_container.setImmediate(true);
        
        gl_container.addComponent(lb_abs,0,0);
        gl_container.addComponent(cb_abs,1,0);
        gl_container.addComponent(lb_allrad,2,0);
        gl_container.addComponent(cb_allrad,3,0);
        gl_container.addComponent(lb_anhaenger,0,1);
        gl_container.addComponent(cb_anhaenger,1,1);
        gl_container.addComponent(lb_ewegfahrsperre,2,1);
        gl_container.addComponent(cb_ewegfahrsperre,3,1);
        gl_container.addComponent(lb_efensterheber,0,2);
        gl_container.addComponent(cb_efensterheber,1,2);
        gl_container.addComponent(lb_esp,2,2);
        gl_container.addComponent(cb_esp,3,2);
        gl_container.addComponent(lb_lmfelgen,0,3);
        gl_container.addComponent(cb_lmfelgen,1,3);
        gl_container.addComponent(lb_schiebedach,2,3);
        gl_container.addComponent(cb_schiebedach,3,3);
        gl_container.addComponent(lb_tempomat,0,4);
        gl_container.addComponent(cb_tempomat,1,4);
        gl_container.addComponent(lb_intarder,2,4);
        gl_container.addComponent(cb_intarder,3,4);
        gl_container.addComponent(lb_scheckheft,0,5);
        gl_container.addComponent(cb_scheckheft,1,5);
        gl_container.addComponent(lb_sitzheizung,2,5);
        gl_container.addComponent(cb_sitzheizung,3,5);
        gl_container.addComponent(lb_standheizung,0,6);
        gl_container.addComponent(cb_standheizung,1,6);
        gl_container.addComponent(lb_standklima,2,6);
        gl_container.addComponent(cb_standklima,3,6);
        gl_container.addComponent(lb_standkühlung,0,7);
        gl_container.addComponent(cb_standkühlung,1,7);
        gl_container.addComponent(lb_umweltplakette,2,7);
        gl_container.addComponent(cb_umweltplakette,3,7);
            
    }
    
    private void fill_table_lkw()
    {
        gl_container = new GridLayout(4,20);

        gl_container.addComponent(lb_umweltplakette,2,7);
        gl_container.addComponent(cb_umweltplakette,3,7);
    }
    
    private void fill_table_transporter()
    {
        gl_container = new GridLayout(4,20);
        
        gl_container.addComponent(lb_scheckheft,0,5);
        gl_container.addComponent(cb_scheckheft,1,5);
    }

And what happens now is this:

At the first step fill_table_pkw is called right and all components are shown.
When I now send a call to fill_table_lkw with an valuechangelistener of a combobox,
the fill_table_lkw is called and now the strange thing happens.

→ The Label and the Combobox lb_umweltplakette and cb_umweltplakette are deleted, all of the other
components stay where they are.

The same happens with cb_scheckheft and lb_scheckheft on fill_table_transporter call.
So after calling the two functions 4components are deleted.

So my question is:
What causes the behaviour that “addComponent” is “DELETING”?

You make the variable gl_container refer to a new GridLayout instance, but the UI hierarchy still refers to the old instance - due to the way Java works, Vaadin cannot know (nor should it care) that you changed some variable somewhere to refer to something new. Then you add those four components to the new (invisible, not attached) instance, which implicitly removes them from the old, still visible one.

A fix:

GridLayout tmp = new GridLayout(4, 20);
tmp.addComponent(...);
tmp.addComponent(...);
// assuming "parent" is the parent of gl_layout
parent.replaceComponent(gl_layout, tmp);
gl_layout = tmp;