This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creation of GUI from xml file

 
Avinash Rakkasagi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have an xml file containing a list of items as-

My question is: How do I code in java in order to display this in a tree structure in a GUI?
It should be displayed as:

Added to it, there should be an option to expand and compress the contents of the tree also.
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Avinash, and welcome to the Ranch!

You would need to load the data into a TreeModel and display it using a JTree. You can read more about using JTree in the tutorial linked from its API.
 
Avinash Rakkasagi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:Hi Avinash, and welcome to the Ranch!

You would need to load the data into a TreeModel and display it using a JTree. You can read more about using JTree in the tutorial linked from its API.


@ Darryl Burke: Could you be more specific, I am new to Java programming. Thanks in advance.
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe he is pointing you to the tutorial - http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic