Problem with visualization of trees...
Hello everyone,
I have a problem concerning a visualization of a tree. I want a tree data structure to represent a priority gueue, and i was, so far, unable to construct a gui that sufficiently represent my tree.
More specifically, the problem really concerns that i dont know the maximum number of elements that the user will give for insert. As a result i can not construct a tree as i did with the array (where i constructed maxzise jpanels and jlabels and worked with the text).
Due to this fact, i dont also know how to add the JPanels to a specific location "outside the screen", meaning below the visuable area of the screen. I Have tried putting a JScrollPane and scrolling down, but the visual area of the screen needs to be filled with elements first!
I Dont know...i am much confused...
So, if anyone can help me out, please help....
Well...
I want to represent a priority queue data structure. This is (as far as the tutorial book of the university is concerned) possible by making a balanced tree. I want a hierarchy, yes, and by hierarchy i mean a "father - child" thing. My proplem is that i can not use absolute possition to place the tree nodes in the screen. In previous visualizations of data structures i have made (p.e. an array) i have used JPanels to represent the nodes of the structure. In the tree case, i dont at all know how to represent my tree.
Please help...
and excuse any English - related problems in my post :-)
Well, I believe what you are looking for is a JTree (Swing). I think you may have better luck with it, although I have not personally tried it. I have an example of it in front of me. If you are using the Java SDK and a similar version that I am, you should be able to find it in your <install> - demo - jfc - SampleTree directory. If not, then I would be happy to email it to you. You could also look it up on a search engine. And, of course, if this is of no help whatsoever, then good luck. I wish I could be of more assistance...