This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 38044
    
  22
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: 19655
    
  18

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: 2155
    
    7
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.
 
Don't get me started about those stupid light bulbs.
 
subject: Set data from arraylist into jtable
 
Similar Threads
JTable(!!!)
trouble with JTable
JTable
trouble with JTable
JTable