private void update() {
   try {
     if (jTable1.getSelectedRow() > -1) {
       String id = jTable1.getValueAt(jTable1.getSelectedRow(), 0).toString();
       global.ActivityType = global.con.createStatement();
       global.ActivityType.executeUpdate(
           "UPDATE activitytypes SET Active = " + active() + " where ActivityTypeID = " + id);
     }
     addAudit(
         "Changed  Activity Type Status: "
             + jTable1.getValueAt(jTable1.getSelectedRow(), 0).toString().replaceAll("'", "''")
             + " to "
             + jTable1.getValueAt(jTable1.getSelectedRow(), 2).toString().replaceAll("'", "''"));
     jTable1.getSelectionModel().clearSelection();
   } catch (SQLException ex) {
     StringWriter error = new StringWriter();
     ex.printStackTrace(new PrintWriter(error));
     SystemCrashDialog crash =
         new SystemCrashDialog(
             global.root,
             true,
             global,
             global.root.getHeaderRootPanel1().getClientComboBox().getSelectedItem().toString(),
             global.root.getHeaderRootPanel1().getMatterComboBox().getSelectedItem().toString(),
             "Err0007",
             error.toString());
   }
 }
  private void loadTable() {
    model = (DefaultTableModel) jTable1.getModel();
    model.setRowCount(0);

    try {
      global.ActivityType = global.con.createStatement();
      global.ActivityTypeRS =
          global.ActivityType.executeQuery("SELECT * FROM activitytypes ORDER BY ActivityTypeName");
      while (global.ActivityTypeRS.next()) {
        if (global.ActivityTypeRS.getInt("active") == 1) {
          model.insertRow(
              global.ActivityTypeRS.getRow() - 1,
              new Object[] {
                global.ActivityTypeRS.getInt("ActivityTypeID"),
                global.ActivityTypeRS.getString("ActivityTypeName"),
                "Yes"
              });
        } else {
          model.insertRow(
              global.ActivityTypeRS.getRow() - 1,
              new Object[] {
                global.ActivityTypeRS.getInt("ActivityTypeID"),
                global.ActivityTypeRS.getString("ActivityTypeName"),
                "No"
              });
        }
      }
    } catch (SQLException ex) {
      StringWriter error = new StringWriter();
      ex.printStackTrace(new PrintWriter(error));
      SystemCrashDialog crash =
          new SystemCrashDialog(
              global.root,
              true,
              global,
              global.root.getHeaderRootPanel1().getClientComboBox().getSelectedItem().toString(),
              global.root.getHeaderRootPanel1().getMatterComboBox().getSelectedItem().toString(),
              "Err0008",
              error.toString());
    }
  }