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....

[881 byte] By [Darth_Debuggera] at [2007-10-2 8:45:08]
# 1

I'm a little confused on your question. What kind of tree data structure are you using (or planning to use)? By a priority GUI do you mean a graphically represented tree structure (like a hierarchy)? How does the program recieve input from the user? And how exactly does JPanel connect to your problem? Could you please clarify? Maybe you could post your code so far.

DMTNTJGDa at 2007-7-16 22:47:32 > top of Java-index,Other Topics,Java Game Development...
# 2

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 :-)

Darth_Debuggera at 2007-7-16 22:47:32 > top of Java-index,Other Topics,Java Game Development...
# 3

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...

DMTNTJGDa at 2007-7-16 22:47:32 > top of Java-index,Other Topics,Java Game Development...