private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed

        ArrayList<String> tagit = new ArrayList<>();

        Component[] lomakkeenSisalto = lomake.getComponents();
        JList tagilista = null;

        for (Component kentta : lomakkeenSisalto) {
            if (kentta instanceof JList) {
                tagilista = (JList) kentta;
                for (Object o : tagilista.getSelectedValuesList()) {
                    tagit.add(o.toString());

                }
            }
        }

        int valinta = 0;
        if (tagit.isEmpty()) {
            JOptionPane.showMessageDialog(this, "Ei valittuja tageja");
        } else if (tagit.size()==1) {
            valinta = JOptionPane.showConfirmDialog(this, "Poistetaanko tagi?");
        } else {
            valinta = JOptionPane.showConfirmDialog(this, "Poistetaanko tagit?");
        }

        if (valinta == JOptionPane.YES_OPTION) {
            for (String tagi : tagit) {
                engine.removeTagi(ckey, tagi);
            }
            paivitaTagit(tagilista);
            mainWindow.paivitaTagit();
        }
    }//GEN-LAST:event_jButton3ActionPerformed