• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTree - expanding nodes

 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello. I can't expand nodes and I don't know why. Here under is the code. It is supposed to create a frame and one tree wrapped in scroll pane, and there should be a button with "expand" written on it. When I click the "expand" button, I expected that tree node will expand, but it doesn't.

One more time, thanks.

 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The TreePath is incorrect. It's a path with only one element, o2. But it needs the parent as well, and the parent's parent, etc. Change it to the following to work:
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You one more time.
Petar
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome
 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You,

Excuse me,
... I still can't make it to work. I appologize for taking time on such a basic things. I can't solve it. It is too much simple , and I don't know what I did wrong now, I can't really imagine what to do next, and I know that it could take me even days for something so simple. If you can see the code that I have made now, I would be very thankfull, and I appologiye one more time for my lack of knowledge and inspiration.

I have passed an array of Objects to the TreePath constructor, I suppose, and I have passed TreePath object to the expandPath method, but it doesn't expand nothing. I have an output to console, where I can see that I have the right Objects, and ... so I am confused...

I don't know how to thank enough.

 
Petar Thomas
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have solved my problem for now like this...

(sorry for bothering...)

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic