• Post Reply Bookmark Topic Watch Topic
  • New Topic

Extract data from JTable  RSS feed

 
Jedrzej Pow
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I built a JTable with several columns and the last contains a JButton. I would like that every time you press the button in the row data from it have been exported out to other object (and therefore outside the class).

Of course, I have getTableCellEditorComponent and getTableCellRendererComponent and I can read data from the JTable, but I have access to them only within that class.

So my only problem is how to send data to another object such as JTextArea.

 
Rob Spoor
Sheriff
Posts: 20903
81
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTable has cool methods like getRowCount(), getColumnCount() and getValueAt(int row, int column). With these you can retrieve the value of every single cell.
 
Jedrzej Pow
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I have said I have no problem with getting data from the JTable, I my only problem is how transfer them to an object declared in another class.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you would do that exactly the same way you would do it with any other data. The fact that the data is coming from a JTable is totally irrelevant.
 
Jedrzej Pow
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed, the problem turned out to be easier to solve than I thought from the beginning. Sorry for the unnecessary problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!