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

        EditQuestionFIB editQPanel = new EditQuestionFIB();
        editQPanel.setDefaultCloseOperation(this.DISPOSE_ON_CLOSE);

        editQPanel.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent windowEvent) {
                refresh();
            }
        });

        editQPanel.setVisible(true);

        connectDb();

        try {

            int rowcheck = questionTable.getSelectedRow();

            if (rowcheck > -1) {

                // Get the selected row
                int selectedRow = questionTable.getSelectedRow();

                // Get & set the question at column number 2 (from the table)
                String rowQuestion = (questionTable.getModel().getValueAt(selectedRow, 2).toString());

                // Get & set the id at column number 1 (from the table)
                rowID = (questionTable.getModel().getValueAt(selectedRow, 1).toString());

                editQPanel.questionID = rowID;

                // Get the full form of the question
                String query = "SELECT * FROM fib WHERE QuestionID='" + rowID + "' ";
                st = con.createStatement();
                rs = st.executeQuery(query);

                String QuestionText = "";
                String Instructions = "";

                while (rs.next()) {
                    QuestionText = rs.getString("QuestionText");
                    Instructions = rs.getString("Instructions");
                }

                editQPanel.instructionField.setText(Instructions);
                editQPanel.questionField.setText(QuestionText);

                // Set the Question field on the edit panel based on the selected row
                rowID = (questionTable.getModel().getValueAt(selectedRow, 1).toString());

            }

        } catch (NullPointerException ex) {
            System.out.println(ex);
        } catch (SQLException ex) {
            Logger.getLogger(AddQuestionFib.class.getName()).log(Level.SEVERE, null, ex);
        }


    }//GEN-LAST:event_editBtnActionPerformed