Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

get the users input from a column  RSS feed

 
dave vanweed
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to columns on my JTable (first name , lastname).
Hello
How can i loop though each column the first column (first names) and get each row and add it to a String array? for example if the user puts in 10 firstnames i want to add all 10 to a string array.
and for the second column i want to add all the rows (last names ) to a arraylist. so if the user puts in 10 lastnames i want to add them to a arraylist.
How can i do this?
thanks
davey
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Davey,
I may be misunderstanding your question, but I think the easiest way is to get the data from the "JTable"'s associated "TableModel". Use the "JTable" method "getModel()" to retrieve the "TableModel", then use the "getValueAt()" method (of "TableModel") to get the required data. Please see the relevant documentation (javadocs) for more details.
Hope this helps.
Good Luck,
Avi.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!