aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Creation of GUI from xml file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Creation of GUI from xml file" Watch "Creation of GUI from xml file" New topic
Author

Creation of GUI from xml file

Avinash Rakkasagi
Greenhorn

Joined: Nov 24, 2011
Posts: 8
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

Joined: May 03, 2008
Posts: 4167
    
    3

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.


luck, db
There are no new questions, but there may be new answers.
Avinash Rakkasagi
Greenhorn

Joined: Nov 24, 2011
Posts: 8
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
Bartender

Joined: May 31, 2011
Posts: 1778
I believe he is pointing you to the tutorial - http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Creation of GUI from xml file
 
Similar Threads
Turn this Java into Groovy!
Set the Text for the xml tag
Set the TextValue for the xml tag
XSLT merging help
convert a db blob of xml into a jdom XML object