• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to capture cell value from JTable

 
Ratheesh Narayanan
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a problem in JTable!
I have an application which is having a JTable and for few cells if I type a value that value should be captured at the time of typing it.
Any idea?

TIA,
Ratheesh
 
Ratheesh Narayanan
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Got the solution!!!
The cell value cannot be captured until and unless the editing stopped. So if you want to get the cell value while its editing you have to capture the component at the location where you are editing..

Component cmp = tblTaskList.getComponentAt(x,y);
JTextField txt = (JTextField)cmp;
String val = txt.getText();

Hope will be helpful for someone who is trying the same, like me!

Thanks,
Ratheesh
 
prashant gour
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we get x and y on particular cell.
will u let me know
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!