title: JavaFx TreeView with CheckBox and ContextMenu
body: <p>in the tutorial <a href="http://docs.oracle.com/javafx/2/ui_controls/tree-view.htm" rel="nofollow">http://docs.oracle.com/javafx/2/ui_controls/tree-view.htm</a> it explain how to create a TreeView with ContextMenu or CheckBox. </p>
  
  <p>but is it possible to have both of them? </p>
  
  <p>when I first copy-paste the code, I learned that I can have only one setCellFactory since they overwrite each other.</p>
  
  <pre><code>    // the following two setCellFactory are copied from the tutorial
  
      // this create TreeCell with ContextMenu
      treeView.setCellFactory(new Callback&lt;TreeView&lt;String&gt;,TreeCell&lt;String&gt;&gt;(){
          @Override
          public TreeCell&lt;String&gt; call(TreeView&lt;String&gt; p) {
              return new TextFieldTreeCellImpl();
              //the class TextFieldTreeCellImp is a TreeCell with ContextMenu
          }
      });
  
      // this create TreeCell with CheckBox
      tree.setCellFactory(CheckBoxTreeCell.&lt;String&gt;forTreeView());
  </code></pre>
  
  <p>then i tried substituting TreeCell with CheckBoxTreeCell</p>
  
  <pre><code>    //class TextFieldTreeCellImpl extends TreeCell&lt;String&gt; {
      class TextFieldTreeCellImpl extends CheckBoxTreeCell&lt;String&gt; {
      ...
      //TreeItem newTag = new TreeItem&lt;String&gt;("New tag");
      CheckBoxTreeItem newTag = new CheckBoxTreeItem&lt;String&gt;("New tag");
  </code></pre>
  
  <p>but the checkbox didn't appear. it's still a normal treeview.</p>