DefaultMutableTreeNode node = getSelectedNode(); if (node == null) return; Experiment experiment = (Experiment)node.getUserObject(); if (!experiment.isEditable()) { int result = JOptionPane.showConfirmDialog(this, "Experiment is not editable; delete anyway?", "Experiment Not Editable", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (result != JOptionPane.YES_OPTION) return; } model.removeNodeFromParent(node); String experimentName = experiment.getExperimentName(); experimentNames.remove(experimentName);  int result = JOptionPane.showConfirmDialog(this, "Delete experiment from database?", "Delete Experiment From Database", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (result != JOptionPane.YES_OPTION) return; ExperimentDB.deleteExperiment(experiment.getExperimentID(), experimentName);
deleteExperimentInNode(getSelectedNode());
  public void deleteExperiment() {    DefaultMutableTreeNode node = getSelectedNode();    if (node == null) return;    Experiment experiment = (Experiment)node.getUserObject();    if (!experiment.isEditable()) {      int result =         JOptionPane.showConfirmDialog(this,                                 "Experiment is not editable; delete anyway?",                                      "Experiment Not Editable",                                      JOptionPane.YES_NO_OPTION,                                      JOptionPane.WARNING_MESSAGE);      if (result != JOptionPane.YES_OPTION)	return;    }    model.removeNodeFromParent(node);    String experimentName = experiment.getExperimentName();     experimentNames.remove(experimentName);    // ask if experiment should be deleted from database    int result =       JOptionPane.showConfirmDialog(this,                                    "Delete experiment from database?",                                    "Delete Experiment From Database",                                    JOptionPane.YES_NO_OPTION,                                    JOptionPane.WARNING_MESSAGE);    if (result != JOptionPane.YES_OPTION)      return;    ExperimentDB.deleteExperiment(experiment.getExperimentID(),                                  experimentName);  }