• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Breadth first tree  RSS feed

 
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?
 
Rancher
Posts: 42975
76
  • 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: 42975
76
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!