rendered paste body public void deleteABookmark() { String s = tree.getLastSelectedPathComponent().toString(); if(tree.getLastSelectedPathComponent() != null) if (s.contentEquals(root.toString())) return; else { File delFile = new File(tree.getLastSelectedPathComponent().toString()); treeModel.removeNodeFromParent((MutableTreeNode)tree.getLastSelectedPathComponent()); delFile.delete(); } else return; } public void valueChanged(TreeSelectionEvent e) { try { if(!tree.getLastSelectedPathComponent().toString().contentEquals("BOOKMARKS") || 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); } }