title: How to add add a TreeModelListener to the NetBeans Outline?
body: <p>I'm using the NetBeans Outline model to create a TreeTable, the technique is described  <a href="http://blogs.oracle.com/geertjan/entry/swing_outline_component" rel="nofollow noreferrer">here</a>:</p>
  
  <p>Everything looks nice and clean and I now want add a TreeModelListener to my model to listen for changes in the model:</p>
  
  <pre><code>Outline outline = new Outline();
  MyNode root = new MyNode("data", 0);
  //...
  TreeModel treeMdl = new MyTreeModel(root);
  OutlineModel mdl = 
  DefaultOutlineModel.createOutlineModel(treeMdl, new MyRowModel(), true, "Data");
  mdl.addTreeModelListener(new MyTreeModelListener());
  outline.setModel(mdl);
  //...
  
  public class MyTreeModelListener implements TreeModelListener {
      public void treeNodesChanged(TreeModelEvent e) {
          System.out.println("Something happend");
  
      }
  
      public void treeNodesInserted(TreeModelEvent e) {
          // TODO Auto-generated method stub
  
      }
  
      public void treeNodesRemoved(TreeModelEvent e) {
          // TODO Auto-generated method stub
  
      }
  
      public void treeStructureChanged(TreeModelEvent e) {
          // TODO Auto-generated method stub
  
      }
  
  }
  </code></pre>
  
  <p>Everything works as expected, but my problem is below, I have written my own TreeModel class and that obviously means that I have to write my own <code>addTreeModelListener</code> method, but how do I do that? </p>
  
  <pre><code>public class MyTreeModel implements TreeModel {
  
      private MyNode root;
  
      public MyTreeModel(SdbNode root) {
          this.root = root;
      }
  
      @Override
      public void addTreeModelListener(TreeModelListener l) {
          //TODO:
      }
  
      //...
  }
  </code></pre>