• Post Reply Bookmark Topic Watch Topic
  • New Topic

Show Directories in JTable  RSS feed

 
Muhammad Asghar
Greenhorn
Posts: 6
Firefox Browser Java MyEclipse IDE
  • Mark post as helpful
  • send pies
  • 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
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • 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.
 
Rob Camick
Ranch Hand
Posts: 2801
15
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!