content: 
  import java.awt.Color;
  import java.sql.Connection;
  import java.sql.SQLException;
  import java.util.logging.Level;
  import java.util.logging.Logger;
  import javax.swing.JOptionPane;
  
  /*
   * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
   * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
   */
  /**
   *
   * @author ahmed
   */
  public class UpdateCourse extends javax.swing.JFrame {
  
      public UpdateCourse() {
  
          initComponents();
          this.setLocationRelativeTo(null);
          CourseTitle.setVisible(false);
          CourseCreditHour.setVisible(false);
          CourseDepartment1.setVisible(false);
  
      }
  
      /**
       * This method is called from within the constructor to initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is always
       * regenerated by the Form Editor.
       */
      @SuppressWarnings("unchecked")
      // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
      private void initComponents() {
  
          jPanel1 = new javax.swing.JPanel();
          courseID = new javax.swing.JTextField();
          jButton8 = new javax.swing.JButton();
          CourseTitle = new javax.swing.JPanel();
          courseTitle = new javax.swing.JTextField();
          updatetitle = new javax.swing.JButton();
          CourseCreditHour = new javax.swing.JPanel();
          credit = new javax.swing.JTextField();
          updatecredit = new javax.swing.JButton();
          CreditHourButton = new javax.swing.JPanel();
          a3 = new javax.swing.JLabel();
          TitleButton = new javax.swing.JPanel();
          a2 = new javax.swing.JLabel();
          DepartmentButton = new javax.swing.JPanel();
          a5 = new javax.swing.JLabel();
          CourseDepartment1 = new javax.swing.JPanel();
          Department_id = new javax.swing.JTextField();
          jButton9 = new javax.swing.JButton();
          jLabel2 = new javax.swing.JLabel();
          jButton10 = new javax.swing.JButton();
  
          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
          setResizable(false);
  
          jPanel1.setBackground(new java.awt.Color(0, 64, 128));
          jPanel1.setPreferredSize(new java.awt.Dimension(572, 500));
  
          courseID.setText("Enter Course's ID");
  
          jButton8.setBackground(new java.awt.Color(0, 64, 128));
          jButton8.setForeground(new java.awt.Color(255, 255, 255));
          jButton8.setText("Enter");
  
          CourseTitle.setBackground(new java.awt.Color(173, 216, 230));
  
          courseTitle.setText("Enter new Course's Title");
          courseTitle.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  courseTitleActionPerformed(evt);
              }
          });
  
          updatetitle.setBackground(new java.awt.Color(0, 64, 128));
          updatetitle.setForeground(new java.awt.Color(255, 255, 255));
          updatetitle.setText("Enter");
          updatetitle.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  updatetitleActionPerformed(evt);
              }
          });
  
          javax.swing.GroupLayout CourseTitleLayout = new javax.swing.GroupLayout(CourseTitle);
          CourseTitle.setLayout(CourseTitleLayout);
          CourseTitleLayout.setHorizontalGroup(
              CourseTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(CourseTitleLayout.createSequentialGroup()
                  .addGap(25, 25, 25)
                  .addGroup(CourseTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addComponent(updatetitle)
                      .addComponent(courseTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))
                  .addContainerGap(33, Short.MAX_VALUE))
          );
          CourseTitleLayout.setVerticalGroup(
              CourseTitleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(CourseTitleLayout.createSequentialGroup()
                  .addGap(45, 45, 45)
                  .addComponent(courseTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                  .addComponent(updatetitle)
                  .addContainerGap(11, Short.MAX_VALUE))
          );
  
          CourseCreditHour.setBackground(new java.awt.Color(173, 216, 230));
  
          credit.setText("New Credit hours");
  
          updatecredit.setBackground(new java.awt.Color(0, 64, 128));
          updatecredit.setForeground(new java.awt.Color(255, 255, 255));
          updatecredit.setText("Enter");
          updatecredit.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  updatecreditActionPerformed(evt);
              }
          });
  
          javax.swing.GroupLayout CourseCreditHourLayout = new javax.swing.GroupLayout(CourseCreditHour);
          CourseCreditHour.setLayout(CourseCreditHourLayout);
          CourseCreditHourLayout.setHorizontalGroup(
              CourseCreditHourLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(CourseCreditHourLayout.createSequentialGroup()
                  .addGap(20, 20, 20)
                  .addGroup(CourseCreditHourLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addComponent(updatecredit)
                      .addComponent(credit, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))
                  .addContainerGap(38, Short.MAX_VALUE))
          );
          CourseCreditHourLayout.setVerticalGroup(
              CourseCreditHourLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(CourseCreditHourLayout.createSequentialGroup()
                  .addGap(49, 49, 49)
                  .addComponent(credit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addComponent(updatecredit)
                  .addContainerGap(13, Short.MAX_VALUE))
          );
  
          CreditHourButton.setBackground(new java.awt.Color(0, 64, 128));
          CreditHourButton.addMouseListener(new java.awt.event.MouseAdapter() {
              public void mouseEntered(java.awt.event.MouseEvent evt) {
                  CreditHourButtonMouseEntered(evt);
              }
              public void mouseExited(java.awt.event.MouseEvent evt) {
                  CreditHourButtonMouseExited(evt);
              }
              public void mousePressed(java.awt.event.MouseEvent evt) {
                  CreditHourButtonMousePressed(evt);
              }
          });
  
          a3.setForeground(new java.awt.Color(255, 255, 255));
          a3.setText("Update Course's Credit hours");
  
          javax.swing.GroupLayout CreditHourButtonLayout = new javax.swing.GroupLayout(CreditHourButton);
          CreditHourButton.setLayout(CreditHourButtonLayout);
          CreditHourButtonLayout.setHorizontalGroup(
              CreditHourButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(CreditHourButtonLayout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(a3, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addContainerGap(31, Short.MAX_VALUE))
          );
          CreditHourButtonLayout.setVerticalGroup(
              CreditHourButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(CreditHourButtonLayout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(a3)
                  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
          );
  
          TitleButton.setBackground(new java.awt.Color(0, 64, 128));
          TitleButton.addMouseListener(new java.awt.event.MouseAdapter() {
              public void mouseEntered(java.awt.event.MouseEvent evt) {
                  TitleButtonMouseEntered(evt);
              }
              public void mouseExited(java.awt.event.MouseEvent evt) {
                  TitleButtonMouseExited(evt);
              }
              public void mousePressed(java.awt.event.MouseEvent evt) {
                  TitleButtonMousePressed(evt);
              }
          });
  
          a2.setForeground(new java.awt.Color(255, 255, 255));
          a2.setText("Update Course's Title");
  
          javax.swing.GroupLayout TitleButtonLayout = new javax.swing.GroupLayout(TitleButton);
          TitleButton.setLayout(TitleButtonLayout);
          TitleButtonLayout.setHorizontalGroup(
              TitleButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(TitleButtonLayout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(a2, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addContainerGap(20, Short.MAX_VALUE))
          );
          TitleButtonLayout.setVerticalGroup(
              TitleButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(TitleButtonLayout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(a2)
                  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
          );
  
          DepartmentButton.setBackground(new java.awt.Color(0, 64, 128));
          DepartmentButton.addMouseListener(new java.awt.event.MouseAdapter() {
              public void mouseEntered(java.awt.event.MouseEvent evt) {
                  DepartmentButtonMouseEntered(evt);
              }
              public void mouseExited(java.awt.event.MouseEvent evt) {
                  DepartmentButtonMouseExited(evt);
              }
              public void mousePressed(java.awt.event.MouseEvent evt) {
                  DepartmentButtonMousePressed(evt);
              }
          });
  
          a5.setForeground(new java.awt.Color(255, 255, 255));
          a5.setText("Update Course's Department");
  
          javax.swing.GroupLayout DepartmentButtonLayout = new javax.swing.GroupLayout(DepartmentButton);
          DepartmentButton.setLayout(DepartmentButtonLayout);
          DepartmentButtonLayout.setHorizontalGroup(
              DepartmentButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, DepartmentButtonLayout.createSequentialGroup()
                  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                  .addComponent(a5)
                  .addGap(20, 20, 20))
          );
          DepartmentButtonLayout.setVerticalGroup(
              DepartmentButtonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(DepartmentButtonLayout.createSequentialGroup()
                  .addContainerGap()
                  .addComponent(a5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                  .addContainerGap())
          );
  
          CourseDepartment1.setBackground(new java.awt.Color(173, 216, 230));
  
          Department_id.setText("New Department ID");
  
          jButton9.setBackground(new java.awt.Color(0, 64, 128));
          jButton9.setForeground(new java.awt.Color(255, 255, 255));
          jButton9.setText("Enter");
          jButton9.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton9ActionPerformed(evt);
              }
          });
  
          javax.swing.GroupLayout CourseDepartment1Layout = new javax.swing.GroupLayout(CourseDepartment1);
          CourseDepartment1.setLayout(CourseDepartment1Layout);
          CourseDepartment1Layout.setHorizontalGroup(
              CourseDepartment1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(CourseDepartment1Layout.createSequentialGroup()
                  .addGap(19, 19, 19)
                  .addGroup(CourseDepartment1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addComponent(jButton9)
                      .addComponent(Department_id, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))
                  .addContainerGap(39, Short.MAX_VALUE))
          );
          CourseDepartment1Layout.setVerticalGroup(
              CourseDepartment1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(CourseDepartment1Layout.createSequentialGroup()
                  .addGap(47, 47, 47)
                  .addComponent(Department_id, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addComponent(jButton9)
                  .addContainerGap(14, Short.MAX_VALUE))
          );
  
          jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Users\\ahmed\\OneDrive\\Desktop\\download-removebg-preview (1) - Copy.png")); // NOI18N
  
          jButton10.setBackground(new java.awt.Color(0, 64, 128));
          jButton10.setForeground(new java.awt.Color(255, 255, 255));
          jButton10.setText("back");
          jButton10.addMouseListener(new java.awt.event.MouseAdapter() {
              public void mousePressed(java.awt.event.MouseEvent evt) {
                  jButton10MousePressed(evt);
              }
          });
  
          javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
          jPanel1.setLayout(jPanel1Layout);
          jPanel1Layout.setHorizontalGroup(
              jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(jPanel1Layout.createSequentialGroup()
                  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addComponent(CourseDepartment1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addComponent(CourseTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addComponent(CourseCreditHour, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addGroup(jPanel1Layout.createSequentialGroup()
                          .addContainerGap()
                          .addComponent(courseID, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                          .addComponent(jButton8)))
                  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                          .addGap(12, 12, 12)
                          .addComponent(jButton10)
                          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                          .addComponent(jLabel2)
                          .addGap(24, 24, 24))
                      .addGroup(jPanel1Layout.createSequentialGroup()
                          .addGap(32, 32, 32)
                          .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                              .addComponent(DepartmentButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                              .addComponent(TitleButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                              .addComponent(CreditHourButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                          .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
          );
          jPanel1Layout.setVerticalGroup(
              jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                  .addContainerGap()
                  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addGroup(jPanel1Layout.createSequentialGroup()
                          .addComponent(jLabel2)
                          .addGap(18, 18, 18)
                          .addComponent(DepartmentButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                          .addComponent(TitleButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                          .addComponent(CreditHourButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                      .addGroup(jPanel1Layout.createSequentialGroup()
                          .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                              .addComponent(courseID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                              .addComponent(jButton8)
                              .addComponent(jButton10))
                          .addGap(18, 18, 18)
                          .addComponent(CourseTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                          .addComponent(CourseCreditHour, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                          .addComponent(CourseDepartment1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                  .addContainerGap(34, Short.MAX_VALUE))
          );
  
          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
          getContentPane().setLayout(layout);
          layout.setHorizontalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 579, Short.MAX_VALUE)
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 431, Short.MAX_VALUE)
          );
  
          pack();
      }// </editor-fold>//GEN-END:initComponents
  
      private void courseTitleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_courseTitleActionPerformed
          // TODO add your handling code here:
      }//GEN-LAST:event_courseTitleActionPerformed
  
      private void CreditHourButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CreditHourButtonMouseEntered
          // TODO add your handling code here:
          a3.setForeground(new java.awt.Color(173, 216, 230));
      }//GEN-LAST:event_CreditHourButtonMouseEntered
  
      private void CreditHourButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CreditHourButtonMouseExited
          // TODO add your handling code here:
          a3.setForeground(Color.WHITE);
  
      }//GEN-LAST:event_CreditHourButtonMouseExited
  
      private void CreditHourButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CreditHourButtonMousePressed
          // TODO add your handling code here:
          CourseTitle.setVisible(false);
          CourseDepartment1.setVisible(false);
          CourseCreditHour.setVisible(true);
  
      }//GEN-LAST:event_CreditHourButtonMousePressed
  
      private void TitleButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TitleButtonMouseEntered
          // TODO add your handling code here:
          a2.setForeground(new java.awt.Color(173, 216, 230));
      }//GEN-LAST:event_TitleButtonMouseEntered
  
      private void TitleButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TitleButtonMouseExited
          // TODO add your handling code here:
          a2.setForeground(Color.WHITE);
  
      }//GEN-LAST:event_TitleButtonMouseExited
  
      private void TitleButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TitleButtonMousePressed
          // TODO add your handling code here:
          CourseTitle.setVisible(true);
          CourseDepartment1.setVisible(false);
          CourseCreditHour.setVisible(false);
  
      }//GEN-LAST:event_TitleButtonMousePressed
  
      private void DepartmentButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DepartmentButtonMouseEntered
          // TODO add your handling code here:
          a5.setForeground(new java.awt.Color(173, 216, 230));
      }//GEN-LAST:event_DepartmentButtonMouseEntered
  
      private void DepartmentButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DepartmentButtonMouseExited
          // TODO add your handling code here:
          a5.setForeground(Color.WHITE);
      }//GEN-LAST:event_DepartmentButtonMouseExited
  
      private void DepartmentButtonMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DepartmentButtonMousePressed
          // TODO add your handling code here:
          CourseTitle.setVisible(false);
          CourseDepartment1.setVisible(true);
          CourseCreditHour.setVisible(false);
  
      }//GEN-LAST:event_DepartmentButtonMousePressed
  
      private void jButton10MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton10MousePressed
          // TODO add your handling code here:
          if (Login.adminlogin) {
              systemManag s = new systemManag();
              s.setVisible(true);
              s.setLocationRelativeTo(null);//center
              this.dispose();
          } else {
              InstructorManag s = new InstructorManag();
              s.setVisible(true);
              s.setLocationRelativeTo(null);//center
              this.dispose();
          }
      }//GEN-LAST:event_jButton10MousePressed
  
      private void updatetitleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updatetitleActionPerformed
          // TODO add your handling code here:
          String Course_Title = courseTitle.getText();
          int course_id = Integer.parseInt(courseID.getText());
  
  // Database operation
          try (Connection connection = ConnectToDB.getConnection(); java.sql.PreparedStatement preparedStatement = connection.prepareStatement(
                  "UPDATE Course SET Title = ? WHERE Course_ID = ?;")) {
  
              // Set values for the prepared statement
              preparedStatement.setString(1, Course_Title);
              preparedStatement.setInt(2, course_id);
  
              // Execute the insert operation
              preparedStatement.executeUpdate();
  
              // Success message
              JOptionPane.showMessageDialog(this, "Course Title Update Successfully");
  
          } catch (SQLException e) {
              Logger.getLogger(SignUp.class.getName()).log(Level.SEVERE, "Database error: ", e);
              JOptionPane.showMessageDialog(this, "An error occurred while saving This data. Please try again.");
          }
      }//GEN-LAST:event_updatetitleActionPerformed
  
      private void updatecreditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updatecreditActionPerformed
          // TODO add your handling code here:
          int credithour = Integer.parseInt(credit.getText());
          int course_id = Integer.parseInt(courseID.getText());
  
  // Database operation
          try (Connection connection = ConnectToDB.getConnection(); java.sql.PreparedStatement preparedStatement = connection.prepareStatement(
                  "UPDATE Course SET Credits = ? WHERE Course_ID = ?;")) {
  
              // Set values for the prepared statement
              preparedStatement.setInt(1, credithour);
              preparedStatement.setInt(2, course_id);
  
              // Execute the insert operation
              preparedStatement.executeUpdate();
  
              // Success message
              JOptionPane.showMessageDialog(this, "Course Credit hours Update Successfully");
  
          } catch (SQLException e) {
              Logger.getLogger(SignUp.class.getName()).log(Level.SEVERE, "Database error: ", e);
              JOptionPane.showMessageDialog(this, "An error occurred while saving This data. Please try again.");
          }
      }//GEN-LAST:event_updatecreditActionPerformed
  
      private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
          // TODO add your handling code here:
          int Dept_id = Integer.parseInt(Department_id.getText());
          int course_id = Integer.parseInt(courseID.getText());
  
  // Database operation
          try (Connection connection = ConnectToDB.getConnection(); java.sql.PreparedStatement preparedStatement = connection.prepareStatement(
                  "UPDATE Course SET Credits = ? WHERE Course_ID = ?;")) {
  
              // Set values for the prepared statement
              preparedStatement.setInt(1, Dept_id);
              preparedStatement.setInt(2, course_id);
  
              // Execute the insert operation
              preparedStatement.executeUpdate();
  
              // Success message
              JOptionPane.showMessageDialog(this, "Course Department Update Successfully");
  
          } catch (SQLException e) {
              Logger.getLogger(SignUp.class.getName()).log(Level.SEVERE, "Database error: ", e);
              JOptionPane.showMessageDialog(this, "An error occurred while saving This data. Please try again.");
          }
      }//GEN-LAST:event_jButton9ActionPerformed
  
      /**
       * @param args the command line arguments
       */
      public static void main(String args[]) {
          /* Set the Nimbus look and feel */
          //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
          /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
           * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
           */
          try {
              for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                  if ("Nimbus".equals(info.getName())) {
                      javax.swing.UIManager.setLookAndFeel(info.getClassName());
                      break;
                  }
              }
          } catch (ClassNotFoundException ex) {
              java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (InstantiationException ex) {
              java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (IllegalAccessException ex) {
              java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (javax.swing.UnsupportedLookAndFeelException ex) {
              java.util.logging.Logger.getLogger(UpdateCourse.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          }
          //</editor-fold>
  
          /* Create and display the form */
          java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  new UpdateCourse().setVisible(true);
              }
          });
      }
  
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JPanel CourseCreditHour;
      private javax.swing.JPanel CourseDepartment1;
      private javax.swing.JPanel CourseTitle;
      private javax.swing.JPanel CreditHourButton;
      private javax.swing.JPanel DepartmentButton;
      private javax.swing.JTextField Department_id;
      private javax.swing.JPanel TitleButton;
      private javax.swing.JLabel a2;
      private javax.swing.JLabel a3;
      private javax.swing.JLabel a5;
      private javax.swing.JTextField courseID;
      private javax.swing.JTextField courseTitle;
      private javax.swing.JTextField credit;
      private javax.swing.JButton jButton10;
      private javax.swing.JButton jButton8;
      private javax.swing.JButton jButton9;
      private javax.swing.JLabel jLabel2;
      private javax.swing.JPanel jPanel1;
      private javax.swing.JButton updatecredit;
      private javax.swing.JButton updatetitle;
      // End of variables declaration//GEN-END:variables
  }
  