@Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource()==cancelButton) {//cancel button
            //Exam exam=new Exam();
            //exam.setVisible(true);
            //this.dispose();
            examPanel.setVisible(false);
            examPanel.getParent().remove(examPanel);
            examPanel.invalidate();
            
        }else if (e.getSource()==okButton) {//submit button
            
            //parentJpanel.repaint();
            sols.Model.Exam exam =new sols.Model.Exam();
            exam.setInstructions(instructionsText.getText());
            exam.setIsPublic(false);
            
            //initialize Exam_DAO and add exam into database
            Exam_DAO exam_DAO=new Exam_DAO();
            exam_DAO.add(exam);
            //close the parentFrame and reopen it
            JFrame fatherFrame=(JFrame)examPanel.getRootPane().getParent();
            //fatherFrame.dispose();
            ExamOverview examOverview=new ExamOverview();
            fatherFrame.setContentPane(examOverview.getGUI());
            fatherFrame.revalidate();
            fatherFrame.repaint();
            //examOverview.setVisible(true);
        }
    }