aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Set data from arraylist into 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 "Set data from arraylist into jtable" Watch "Set data from arraylist into jtable" New topic
Author

Set data from arraylist into jtable

rahul S Sharma
Greenhorn

Joined: Jun 08, 2011
Posts: 21
Hi All,

I am getting data in my ArrayList. Now I want that data to be placed in jtable through AbstractTableModel. How can i achieve this.

regards...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40064
    
  28
I presume you have been through tutorials etc?
rahul S Sharma
Greenhorn

Joined: Jun 08, 2011
Posts: 21
Hi Ritchie
Thanks for your help. I have gone through the tutorial but didn't find any solution related to my problem. So I would appreciate if you could give some guidelines or any link that can solve my problem....

regards...
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19794
    
  20

The "Creating a Table Model" section should be able to help you along the way. They use an Object[][], but using a List is not much different.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2227
    
    8
You can use Row Table Model as a starting point (after reading the Swing tutorial).
Haris Tasawar
Ranch Hand

Joined: Aug 19, 2011
Posts: 30
Yes you can... you can simply create a class which extends a table model e.g abstract table model and just implement the table model methods i.e getcolumncount(), getrowcount() and getbvalueat() methods... and you`ll be good to go.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Set data from arraylist into jtable