title: Completely expand all node of a Jtree (including children)
body: <p>I found some details on the internet for this problem but the solution does not seem to work.</p>
  <p>I want to be able to expand all the nodes ( including the leaf nodes ) of a <code>JTree</code>. This is the code I have so far.</p>
  <pre><code>    tree = new JTree(treeModel);
      tree.setShowsRootHandles(true);
      tree.setEditable(true);
      tree.addTreeSelectionListener(treeSelectionListener);
      tree.addMouseListener(mouselistener);
      tree.setCellRenderer(new FileCellRenderer());
  
        for (int i = 0; i &lt; tree.getRowCount(); i++) {
              
              tree.expandRow(i);
          }
  </code></pre>
  <p>This however does not expand all the leaf nodes. What I get is IMAGE <strong>A</strong> but what I want is IMAGE <strong>B</strong>:</p>
  <p><img src="https://i.stack.imgur.com/FSKVL.png" alt="IMAGE A " />
  <img src="https://i.stack.imgur.com/E13ZK.png" alt="IMAGE B " /></p>