List of usage examples for javax.swing.tree TreeModel addTreeModelListener
void addTreeModelListener(TreeModelListener l);
TreeModelEvent
posted after the tree changes. From source file:plugin.notes.gui.NotesView.java
private void initTree() { dataDir.listFiles();/*from w w w. ja va 2 s . c o m*/ root = new NotesTreeNode(dataDir.getName(), dataDir, notesTree); TreeModel model = new DefaultTreeModel(root); notesTree.setModel(model); notesTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent evt) { notesTreeActionPerformed(); } }); notesTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); notesTree.setEditable(true); model.addTreeModelListener(new TreeModelListener() { @Override public void treeNodesChanged(TreeModelEvent e) { notesTreeNodesChanged(); } @Override public void treeNodesInserted(TreeModelEvent e) { // TODO: Method does nothing? } @Override public void treeNodesRemoved(TreeModelEvent e) { // TODO: Method does nothing? } @Override public void treeStructureChanged(TreeModelEvent e) { // TODO: Method does nothing? } }); }