The Artima Developer Community
Sponsored Link

Java Answers Forum
JTree

4 replies on 1 page. Most recent reply: May 25, 2004 10:10 PM by Singh M.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 4 replies on 1 page
Richard Lewis

Posts: 1
Nickname: richiehere
Registered: May, 2004

JTree Posted: May 21, 2004 12:52 AM
Reply to this message Reply
Advertisement
I have a tree control that simpley reflect the files and folders present on a machine. I need to refresh a portion of the tree control so that changes made to files/folders icons are <b>auto-updated</b> in the tree control. How do i do this?

Any help will be greatly appreciated.


Daniel Ray

Posts: 53
Nickname: budoray
Registered: Oct, 2002

Re: JTree Posted: May 21, 2004 2:29 AM
Reply to this message Reply
If I understand you right, you'll want to subclass DefaultTreeModel

Singh M.

Posts: 154
Nickname: ms
Registered: Mar, 2002

Re: JTree Posted: May 21, 2004 7:12 PM
Reply to this message Reply
Use JFileChooser. It has all the functionality that you want, moreover, there is no point in reinventing the wheel.

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: JTree Posted: May 25, 2004 2:30 AM
Reply to this message Reply
How can you set JFileChooser to a TreeView?

Even if that works, JFileChooser does not update the view if a file was added or removed using other programs.

It does not listen to addFile / removeFile / moveFile Events from the operating system.

Singh M.

Posts: 154
Nickname: ms
Registered: Mar, 2002

Re: JTree Posted: May 25, 2004 10:10 PM
Reply to this message Reply
JFileChooser does not update the view if a file was added or removed using other programs.

--------------------

But there is a method in JFileChooser called rescanCurrentDirectory(). Although it does not listen to add/remove/move file events, but I find that it is more than sufficient for most applications.

Flat View: This topic has 4 replies on 1 page
Topic: DB connectivity Previous Topic   Next Topic Topic: Some hints would be awesooome

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use