rendered paste body public void deleteABookmark() { if (tree != null) { if(tree.getLastSelectedPathComponent() != null) treeModel.removeNodeFromParent((MutableTreeNode)tree.getLastSelectedPathComponent()); else return; } else return; } public void valueChanged(TreeSelectionEvent e) { try { if (tree == null) return; else { if(tree.getLastSelectedPathComponent() != null) { BufferedReader in = new BufferedReader(new FileReader("bookmarks/" + tree.getLastSelectedPathComponent().toString())); String s = in.readLine(); if(s!=null) { main.changeUrl(s); main.addToHistory(s); main.changeHistoryIndex(); main.checkButtons(); } } else JOptionPane.showMessageDialog(main, "That file is not a valid Bookmark file.","Invalid bookmark file",JOptionPane.ERROR_MESSAGE); } } catch (IOException exc) { JOptionPane.showMessageDialog(main,"That bookmark doesn't appear to exist.","Bookmark does not exist.",JOptionPane.ERROR_MESSAGE); } }