private void posizionaComponenti()
    {
        // Prepara il GroupLayout
        this.remove(pannello);                              // Rimuove il pannello
        pannello = new JPanel();                            // Ne crea uno nuovo
        GroupLayout layout = new GroupLayout(pannello);     // Crea un nuovo GroupLayout
        pannello.setLayout(layout);                         // Applica un nuovo GroupLayout
        this.add(pannello);                                 // Reinserisce il pannello immacolato. Tutto questo perché altrimenti non si possono eliminare le righe in eccesso.
        
        layout.setAutoCreateGaps(true);
        layout.setAutoCreateContainerGaps(true);
        
        // Imposta i gruppi orizzontali
        GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup();
        layout.setHorizontalGroup(hGroup);
        {
            GroupLayout.ParallelGroup pGroup = layout.createParallelGroup(LEADING);
            hGroup.addGroup(pGroup);
            for (int i=0; i<calcoli; i++)
            {
                pGroup.addComponent(btnRimuovi.get(i));
            }
        }
        {
            GroupLayout.ParallelGroup pGroup = layout.createParallelGroup(LEADING);
            hGroup.addGroup(pGroup);
            pGroup.addComponent(cbbSpazio);
            for (int i=0; i<calcoli; i++)
            {
                pGroup.addComponent(txtSpazio.get(i));
            }
        }
        {
            GroupLayout.ParallelGroup pGroup = layout.createParallelGroup(LEADING);
            hGroup.addGroup(pGroup);
            pGroup.addComponent(cbbTempo);
            for (int i=0; i<calcoli; i++)
            {
                pGroup.addComponent(txtTempo.get(i));
            }
        }
        {
            GroupLayout.ParallelGroup pGroup = layout.createParallelGroup(LEADING);
            hGroup.addGroup(pGroup);
            pGroup.addComponent(cbbVelocita);
            for (int i=0; i<calcoli; i++)
            {
                pGroup.addComponent(txtVelocita.get(i));
            }
        }
        {
            GroupLayout.ParallelGroup pGroup = layout.createParallelGroup(LEADING);
            hGroup.addGroup(pGroup);
            pGroup.addComponent(cbbMassa);
            for (int i=0; i<calcoli; i++)
            {
                pGroup.addComponent(txtMassa.get(i));
            }
        }
        {
            GroupLayout.ParallelGroup pGroup = layout.createParallelGroup(LEADING);
            hGroup.addGroup(pGroup);
            pGroup.addComponent(cbbEnergia);
            for (int i=0; i<calcoli; i++)
            {
                pGroup.addComponent(txtEnergia.get(i));
            }
        }
        {
            GroupLayout.ParallelGroup pGroup = layout.createParallelGroup(LEADING);
            hGroup.addGroup(pGroup);
            for (int i=0; i<calcoli; i++)
            {
                pGroup.addComponent(btnAggiungi.get(i));
            }
        }
        // Imposta la stessa dimensione per i pulsanti Aggiungi e Rimuovi
        for (int i=0; i<calcoli; i++)
        {
            layout.linkSize(SwingConstants.HORIZONTAL, btnAggiungi.get(i), btnRimuovi.get(i));
        }
        
        // Imposta i gruppi verticali
        GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup();
        layout.setVerticalGroup(vGroup);
        {
            GroupLayout.ParallelGroup pGroup = layout.createParallelGroup(BASELINE, false);
            vGroup.addGroup(pGroup);
            pGroup.addComponent(cbbSpazio);
            pGroup.addComponent(cbbTempo);
            pGroup.addComponent(cbbVelocita);
            pGroup.addComponent(cbbMassa);
            pGroup.addComponent(cbbEnergia);
        }
        for (int i=0; i<calcoli; i++)
        {
            GroupLayout.ParallelGroup pGroup = layout.createParallelGroup(BASELINE, false);
            vGroup.addGroup(pGroup);
            pGroup.addComponent(btnRimuovi.get(i));
            pGroup.addComponent(txtSpazio.get(i));
            pGroup.addComponent(txtTempo.get(i));
            pGroup.addComponent(txtVelocita.get(i));
            pGroup.addComponent(txtMassa.get(i));
            pGroup.addComponent(txtEnergia.get(i));
            pGroup.addComponent(btnAggiungi.get(i));
        }
        setMinimumSize(getPreferredSize()); // Imposta la dimensione minima
        pack();                             // Setta la dimensione minima
    }