@Override
    public void itemStateChanged(ItemEvent e) {
        Object sourceBox = e.getItemSelectable();
        int indexBox = 0;
        for (JCheckBox box : listCheckBoxes) {
            indexBox++;
            if (sourceBox == box)
            {
                break;
            }
        }
        if (e.getStateChange() == ItemEvent.SELECTED) {
            if (indexBox > 0 && indexBox < 31) {
                insertToDb(indexBox);
                showTextInTextPaneForShowingDetailsOfTicket(indexBox);
            }
        }
        if (e.getStateChange() == ItemEvent.DESELECTED) {
            if (indexBox > 0 && indexBox < 31) {
                deleteFromDB(indexBox);
                textPaneForShowingDetailsOfTicket.setText("Tiket je izbrisan iz baze!");
            }
        }
    }