• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Breadth first tree

 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to build a jtree that gives you more of a breadth first look? If so, how would I go about implementing this?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which child nodes (and grandchild nodes etc.) are shown is completely up to the application. You can simply by default show all children of the root, and none of the grandchildren, thus showing the full breadth, and none of the depth.
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you but that wasn�t exactly what I was looking for. I�ll explain a bit better-I hope. Typically the tree shows depth-first as in a file system. I wish to show breadth-first(Horizontal) as in an organization. I�ve included an example

Typical tree
Root
-A
-A.1
-A.2
-A.2.1
-B
-B.1

What I would like to show is breadth-first

Root
/ \
A B
/ | \
A.1 A.2 B.1
|
A.2.1
I hope that is clearer...
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Formatting got a bit messed up...I'll try again
Depth First
Root
-A
-A.1
-A.2
-A.2.1
-B
-B.1

Breadth First
Root
/ \
-A -B
/ | \
-A.1 -A.2 -B.1
|
-A.2.1
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it. JTree expands and displays its nodes vertically; you can't change that to a more horizontal view.
 
Pat Peg
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That isn't what I wanted to here but it was the thing I expected. No way huh? Well, thanks for letting me know.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic