• 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:

file explorer

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know the code that will list all the drives available. I also know the code that will list all the files and folders in a given directory. Finally, I just learned that we can use jfilechooser in open/save scenarios and jtree to list the folders the same way windows explorer does. You have the collapse/expand column on the left and on the right you see the avialable files/folders in that location. My question is:
Is there a code that does all this or does everyone have to write it themselves? I just want to know if java has something like this before or not because I haven't foudn one but that could be because I'm googling the wrong keywords
 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know if there is such a component, but it wouldn't be that hard to implement yourself. A JSplitPane is the main component. On the left side you have a JTree inside a JScrollPane. This JTree can use a custom TreeModel that uses java.io.File; I've written such a TreeModel myself once. On the right side you have a JTable inside a JScrollPane. The JTree gets a selection listener that updates the JTable's model when a folder in the tree gets selected.
 
Leo Max
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya I know how I can do this myself. I jsut figured it'd be easier if it already existed But I don't know what JSPLITPANE is. I had to google it just now when I read your reply. I was thinking I'd use a frame, container set to borderlayout or any other one since it's only two panels i'll b using, and of course the two panels. one to set my jtree and the other to display list of names of files and folders. So thank you for the reply. I will be using JSPLITPANE instead. It's new.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A class that will be useful to you is javax.swing.filechooser.FileSystemView
 
If a regular clown is funny, then a larger clown would be funnier. Math. Verified by this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic