I have created a dialog box which shows the instructors and courses where I want the admin to assign an instructor to the course. This is the dialog box: enter image description here
When I press on assign, it will fill the instructor column in the JTable below with the instructor's name (from the Name textfield).
However, I also want a dialog box to appear which displays all the courses where the name of the instructor is the one in the textfield. In this case, I want a dialog box that shows that information of the courses with the instructor name from the textfield name. (information same as the courses table)
This is actionlistener for assign button:
Assign.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Connection con = coursescon();
String InstructorName = NameField.getText();
String CourseCode = CourseCodeField.getText();
String query = "UPDATE courseslist SET instructor = '"+InstructorName+"' WHERE code = " +CourseCode+";";
try {
PreparedStatement pSt = con.prepareStatement(query);
pSt.executeUpdate();
DefaultTableModel model = (DefaultTableModel) CoursesTable.getModel();
model.setRowCount(0);
showCourses();
//JOptionPane.showMessageDialog(null, "Assigned Successfully!");
//AssignedCoursesDialog Dialog = new AssignedCoursesDialog();
//DefaultTableModel DialogModel = (DefaultTableModel) Dialog.Assignedtable.getModel();
}
How can I do the dialog box or the GUI if a dialog box is difficult to do?