Expanding and Collapsing JTree

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rahsaan Page

    Expanding and Collapsing JTree

    Hello Everybody,

    I am trying to write a file Explorer program in Java, i go the Frame, Basic
    Menu and Tree going. But now i have the C: listed and i need some help
    expanding and collaping the HDD to se Folders and Files contained in there
    C:..

    Help is greatly apprciated..

    Thanks
    --Rahsaan


  • Robert Larsen

    #2
    Re: Expanding and Collapsing JTree

    Rahsaan Page wrote:
    Hello Everybody,
    >
    I am trying to write a file Explorer program in Java, i go the Frame, Basic
    Menu and Tree going. But now i have the C: listed and i need some help
    expanding and collaping the HDD to se Folders and Files contained in there
    C:..
    >
    Help is greatly apprciated..
    >
    Thanks
    --Rahsaan
    >
    >
    You should probably implement a TreeNode extended class to wrap
    java.io.File objects and implement the TreeWillExpandL istener. Then when
    you get the treeWillExpand event you check which File object the user is
    trying to expand and then just list the files under that object,
    creating TreeNode objects for each and tell the tree that the node has
    been updated.

    Comment

    Working...