• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Quick JTree Question...

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello:
Is there a way to set a treeNode that does not currently contain any childern with the closedFolderIcon instead of the leafIcon?
Example:
If I created a node that allows childern, but is currently empty, I would like to display this node with the closedFolderIcon. This would be similar to an empty directory within a file system.
I plan on having a "Add Folder" and "Add Node" button to manipulate the tree.
When I add a rootNode to the JTree I get a leafIcon instead of the closedFolderIcon. I only get the closedFolderIcon once I have added a childNode to the rootNode.
Any ideas?
Thanks,
claude jones
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Claude,
Just one. Look at the following code. I have bolded the important items to do what you want.

Regards,
Manfred.
 
claude jones
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Manfred,
Thanks for the reply. That did the trick!
claude
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic