• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable displaying input data onto console

 
Zaki Fahmi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a created a simple 3X3 JTable and I would like to add a listener so that when a user inputs data (for example a number) into any cell, the data gets printed onto the ide console (like when you print out Hello World! to the console/screen).

Also when the user goes onto another cell to input data that also appears on the console.

Example: Cell 1 user inputs 2563, and then on cell 2 inputs 01
it appears as:
2563
01

I have tried using this simple code but it results in an error




Any simple example to make this work will be greatly appreciated, Thanks.
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to get involved in the editing process you could work with an editor listener. To simply print out the change you could add a listener to the TableModel which is apprised of all successful edits to the table.
 
Zaki Fahmi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot!!! It works perfectly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic