This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Set data from arraylist into jtable  RSS feed

 
rahul S Sharma
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 55681
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I presume you have been through tutorials etc?
 
rahul S Sharma
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21088
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Camick
Ranch Hand
Posts: 2800
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Row Table Model as a starting point (after reading the Swing tutorial).
 
Haris Tasawar
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!