• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

JTree and JFreechart in a single window

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI all

My requirement is that i have to create an UI which contains two frames one on the left and one on the right.The left frame should display various nodes using JTree.Now when i click on one of the nodes of the tree,the right frame should display an xy plot using JFreechart based on the node selected.Separately i am able to make a Jtree having various nodes and a JFreechart of xy plot but together in a single window is it possible?Pointers to the same would be appreciated

Thanks
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's easily possible. You'd use a layout that can place components next to one another horizontally, like BoxLayout or GridLayout. Then you add two JPanels to that layout, which you can fill with whatever content you want (or add the JTree and JFreeChart components directly, without an intermediate JPanel).
 
Ajay Singh
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks ulf for the reply

Now what i am doing is i have created file menu which contains "Open" and "Exit".Now if i click on the open button ,i will select an xml file and that xml file is to be loaded as a JTree.Without the file menu ,directly i am able to load an xml file in a JTree( in a separate program).What to put in the actionlistener part while clicking the "Open".Please help.
 
Ulf Dittmer
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what you're asking. Obviously, there needs to be code to get the filename (that'll involve a JFileChooser), and then you need to parse the XML (probably using a SAX parser through the JAXP API) and build up the JTree during parsing.
If you're unsure about any specific step, tell us what you have so far, and where you're stuck making progress. Note that XML questions should go into the XML forum.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic