• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Show Directories in JTable

 
Greenhorn
Posts: 6
MyEclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, All,

I have an application in which user selects a folder from JTree and Files are shown in the JTable, that is on the right side of JTable, I want that JTree should display only Directories and JTable should display the folders(child) and files also,
Please help,
This will be a Huge Favor.

By the way i have my own renderer for JTable
thanks
 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps you can consider using the JXTreeTable class from SwingX project. It's perfect for showing hierarchies in a JTable.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I want that JTree should display only Directories and JTable should display the folders(child) and files also,



So what is your problem?

a) do you know how to create a JTree?
b) do you know how to create a JTable?
c) do you know how to get a list of directories?
d) do you know how to get a list of directories and tables?

Put the above solutions together and you have your problem solved.

You can start by reading the Swing tutorial. It has sections on "How to Use Trees" and "How to Use Table". Then you can check out the File API it has a list(...) method for getting the files and directories of a directory.

If you need more help then post your SSCCE showing the problem.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic