private void delete_branch_locations() { int row = tbl_branch_locations.getSelectedRow(); if (row < 0) { return; } final to_branch_locations to = (to_branch_locations) tbl_branch_locations_ALM.get(tbl_branch_locations.convertRowIndexToModel(row)); if (to.status == 1) { Alert.set(0, "Cannot Delete Default Location"); return; } Window p = (Window) this; Dlg_auth nd = Dlg_auth.create(p, true); nd.setTitle(""); nd.setCallback( new Dlg_auth.Callback() { @Override public void ok(CloseDialog closeDialog, Dlg_auth.OutputData data) { closeDialog.ok(); jProgressBar1.setString("Loading...Please wait..."); jProgressBar1.setIndeterminate(true); btn_new.setEnabled(false); btn_add.setEnabled(false); btn_edit.setEnabled(false); btn_delete.setEnabled(false); Thread t = new Thread( new Runnable() { @Override public void run() { S1_branch_locations.delete_branch_locations(to); data_cols(); clear_branch_locations(); Alert.set(3, ""); jProgressBar1.setString("Finished..."); jProgressBar1.setIndeterminate(false); btn_new.setEnabled(true); btn_add.setEnabled(true); btn_edit.setEnabled(true); btn_delete.setEnabled(true); } }); t.start(); } }); nd.setLocationRelativeTo(jScrollPane2); nd.setVisible(true); }