folderNames.remove(node.getUserObject());
  private void deleteEmptyFolders(DefaultMutableTreeNode node) {    ArrayList nodesToDelete = new ArrayList();    Enumeration nodes = node.depthFirstEnumeration();    nodes.nextElement(); // skip the first node which is the start node    while (nodes.hasMoreElements()) {      DefaultMutableTreeNode childNode =        (DefaultMutableTreeNode)nodes.nextElement();      // if a node is a folder and a leaf, add it to the list to delete      Object o = childNode.getUserObject();      if (o instanceof String && childNode.isLeaf())        nodesToDelete.add(childNode);    }    for (int i = 0; i < nodesToDelete.size(); i++)      model.removeNodeFromParent((DefaultMutableTreeNode)nodesToDelete.get(i));    // if original folder is now empty, just delete it    if (node.isLeaf()) {      model.removeNodeFromParent(node);      return;    }    // if we deleted any nodes, then scan the tree again    if (nodesToDelete.size() != 0)      deleteEmptyFolders(node);  }