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

        // Checks wether a file is selected or not
        if (!textFieldFilePath.getText().isEmpty()) {

            // Checks wether a task has been selected
            // -1 is the equivalent of no row selected
            int selection = tableAllTasks.getSelectedRow();
            if (selection != -1) {

                //Everything is good, continue to save file and update GUI
                try {
                    // Save in database
                    control.saveFile(textFieldFilePath, tableAllTasks);
                    // retrieve all tasks with the associated taskID and updates the list
                    control.updateFileList(listFilesAttached, tableAllTasks);
                    textFieldFilePath.setText("");

                } catch (IOException ex) {
                    Logger.getLogger(TaskHandlingPanel.class.getName()).log(Level.SEVERE, null, ex);
                } catch (SQLException ex) {
                    Logger.getLogger(TaskHandlingPanel.class.getName()).log(Level.SEVERE, null, ex);
                }
                // No task selected
            } else {
                JOptionPane.showMessageDialog(null, "Du har ikke valgt en opgave som filen skal tilknyttes!\nVælg venligst en opgave i tabellen!", "Manglende opgave selektion", JOptionPane.ERROR_MESSAGE);
            }

            // No file chosen
        } else {
            JOptionPane.showMessageDialog(null, "Du har ikke valgt en fil der skal uploades!\nVælg venligst en fil via 'Vælg Fil' knappen!", "Manglende fil selektion", JOptionPane.ERROR_MESSAGE);

        }




    }//GEN-LAST:event_buttonSaveFileActionPerformed