DefaultMutableTreeNode node = getSelectedNode(); SocietyComponent society = (SocietyComponent)node.getUserObject(); if (!society.isEditable()) { int result = JOptionPane.showConfirmDialog(this, "Society has been or is being used; delete anyway?", "Society Not Editable", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (result != JOptionPane.YES_OPTION) return; } model.removeNodeFromParent(node); societyNames.remove(society.getSocietyName());
deleteSocietyInNode(getSelectedNode());
  public void deleteSociety() {    DefaultMutableTreeNode node = getSelectedNode();    SocietyComponent society = (SocietyComponent)node.getUserObject();    if (!society.isEditable()) {      int result = JOptionPane.showConfirmDialog(this,						 "Society has been or is being used; delete anyway?",						 "Society Not Editable",						 JOptionPane.YES_NO_OPTION,						 JOptionPane.WARNING_MESSAGE);      if (result != JOptionPane.YES_OPTION)	return;    }    model.removeNodeFromParent(node);    societyNames.remove(society.getSocietyName());  }