File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Jlist or Jtable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jlist or Jtable?" Watch "Jlist or Jtable?" New topic
Author

Jlist or Jtable?

Emili Calonge
Ranch Hand

Joined: May 17, 2003
Posts: 84
I want to create a list of files, where I want to show more tahn one field on each row, for example, I want to show a file name, size, date,... Can I do this thith a list or I have to use JTable, because I don't know how to do it with JLits. I need to be able to select a row and then work with it's content, is it posible with JTable?? Thanks
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
a multi-columned Jlist is simple enough, but the task sounds
as though a JTable would be a better option
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
I would definitely go with JTable. You'll have column headers and the user
will be able to resize columns (long file names)!


There is no emoticon for what I am feeling!
Emili Calonge
Ranch Hand

Joined: May 17, 2003
Posts: 84
Thanks a lot, I'll go with JTable, but can anyone tell me how I can do something with the selected row??
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Originally posted by Emili Calonge:
Thanks a lot, I'll go with JTable, but can anyone tell me how I can do something with the selected row??


Too vague. Are you asking:
* how to be notified when the selection changes?
* how to get the selected row(s)?
* how to get data from the model of the table?
* what you can do ??? with data?
* how to *change* data in the model of the table?

Be clear.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Jlist or Jtable?