Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

displaying data in JTree...

  • 02-03-2004 12:39PM
    #1
    Posts: 431 ✭✭


    Hey all,

    In Java, I want to display the contents of directories on a drive (Windows), like Windows Explorer.

    My method to populate the tree works nicely, however, the problem is when it comes across a folder with nothing inside, but is still a folder, it is displayed in the tree as a leaf node, which doesn't have the normal folder symbol.

    I could just have all leaf nodes look the same but I don't wish to do this approach, if there is another way that anyone can think of, that would be great.

    Thanks!


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    You can use java.util.Files isDirectory() to determine if something is a directory regardless of the number of children it has. You should use this when determining your CellRenderers.


Advertisement