title: JTree set node name as one of UserObject attribute
body: <p>I'm using JTree to create tree view and add node to its root as following:</p>
  
  <pre><code>String nodeName = "node1";
  DefaultMutableTreeNode child = new DefaultMutableTreeNode(nodeName);
  root.add(child);
  </code></pre>
  
  <p>The <code>UserObject</code> for each node now has type of <code>String</code>. It shows <code>"node1"</code> as node name when display the tree.</p>
  
  <p>However, I want to add <code>UserObject</code> to the node as an Object of the <code>nodeObject</code> class with 2 attributes:</p>
  
  <pre><code>private class nodeObject{
      private String nodeName;
      private boolean isSomethingElse;
      public nodeObject(String name, boolean something){
         nodeName = name;
         isSomethingElse = something;
      }
      public String getName(){
         return nodeName;
      }
      //Other setter/getter after these code
  }
  </code></pre>
  
  <p>When I add this nodeObject to tree node:</p>
  
  <pre><code>nodeObject nodeObject = new nodeObject("node1",true);
  DefaultMutableTreeNode child = new DefaultMutableTreeNode(nodeObject);
  root.add(child);
  </code></pre>
  
  <p>It shows the <code>object ID</code> as node name.
  My question is, how i can set the node name as <code>nodeObject.getName()</code> so the tree can show <code>"node1"</code> as node name?</p>
  
  <p>Any reply is much appreciated. Thank you!</p>