title: Displaying a tree data structure in Java GUI
body: <pre><code>I intend to display a tree in Java GUI. 
  </code></pre>
  
  <p>The nodes of the tree will depict the function names of the program which the user will enter during runtime and the edges of the tree will depict a function call. So if main calls func1, there will be 2 nodes in the tree (main and func1) and an edge from main to func1. It will differ according to the program which the user entered. This tree may not be a binary tree since a single function may call more than two functions and may be recursive.</p>
  
  <p>I studied JTree and I felt I wont be getting the desired output in the desired design using it.</p>
  
  <p>I even consider tools such as Prefuse but that will increase the size of my application.
  Is there any other way of displaying the above? </p>
  
  <p>Desired Output -
  If the program is</p>
  
  <pre><code>void main()   //program begins here
  {
     func1();
     func2();
  }
  
  void func1()
  {
        x=0;
       if(x&lt;5)
       {
          func1();
          x++;
       }
  }
  
  void func2()
  {
        sum();
        diff();
        mul();
  }
  
  void sum()
  {
        printf("2+5=7");
  }
  void diff()
  {
        printf("2-5=-3");
  }
  void mul()
  {
       printf("2*5=10");
  }
  
  Its output should be-
  
                 main
                /   \
               /     \
        -----&gt;func1  func2
        |-------|    /  \  \
                    /    \  \ 
                   sum   diff mul
  </code></pre>
  
  <p>I was not able to display the image. Its in
  <a href="http://postimg.org/image/5uovbguz9/" rel="nofollow">http://postimg.org/image/5uovbguz9/</a></p>