Results 1 to 4 of 4

Thread: JTree, Model, TreeNodes etc... HELP

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    UK
    Posts
    222

    JTree, Model, TreeNodes etc... HELP

    Hello

    I have been using the DeafultMutableTreeNode and build an Array LIst with my various bits of information, this displays fine, but when i add an element to my Array LIst i can't seem to get the tree to update properly. Some one suggested i shold write my own MVC aprach for it.

    I was wondering if someone could possibly explain which parts i would need to implement to achieve the desired tree.

    The tree heirarchy, as i said earlier is an ArrayList of Array List, i think thats straight forward enough, now when i add a new element to one of these arraylists anywhere indise of my heirarchy array list i want to the tree to update automatically...

    does that make sense?!

    I guess the question is, what do i have to implement to get this to work for me, the Tree Model, the TreeNode or something else?!

    Cheers in advance

    Andy

  2. #2

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2001
    Location
    UK
    Posts
    222
    ah thank you


    i have sorted my problem now, and foudn the problem was with a JScrollPane rather than the way i was repopulatig my tree.

    Does anyone know why adding a JTree straight to a JScrollPane caused refresh problem, but adding the JTree to a JPanel and then to the JScrollPane solved it..
    bizarre



    Cheers again

    Andy

  4. #4
    Addicted Member Virtual24's Avatar
    Join Date
    May 2001
    Posts
    228
    I dunno about that, but i think there is an update() method in the TreeModel class... dunno if it actually works tho... :-D
    To protect time is to protect everything...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width