• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to add JLIst more columns  RSS feed

 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I created a gui ftp application.
In order to view the directories/files I am using JList.
How can I add into the JLIst more columns so I could see the directories/files authorization. (something like ls –l in unix)

For example <dir name> drwxr-xr-x

Thanks
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JList only supports a single column; you could use JTable instead.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can provide your custom renderer to display the information, but I doubt it will be worth the effort.
Like Ulf suggested, the best way would be to use a JTable
 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so JTable is the preferred way to use for file system view?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No.
A JTree is the usual way, but since you mentioned columns, we suggested JTable.

JList, JTable and JTree all share the concept of Renderers.
A JTree is a logical representation of the containment hierarchy (folders inside folders...)
However, to suit your requirement, you might consider providing a renderer to the tree, which will display the information you want.

You might find this useful
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the idea is to write gui for FTP , its look like the jtable is more fit regarding the client view
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Pierre Sugar
Ranch Hand
Posts: 62
Java Ruby Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could also check out this Tree Table
 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!