File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to detect single click on any cell of JTable ?

 
Mahajan Bhupendra
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
i m using JTable in my application
i want to detect a mouse click on any cell with cell row and
col number..
how should i do that because JTable is having only TableEventListener which detects only change in table cell..
Bhupendra Mahajan
 
Paul Stevens
Ranch Hand
Posts: 2823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your mouse event code put in this:
Point pnt = evt.getPoint();
int row = table.rowAtPoint(pnt);
int col = table.columnAtPoint(pnt);

That will give you the row and column.
 
Mahajan Bhupendra
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankx paul
It works...
How u have so much knowledge and i don't??
Bhupendra Mahajan
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic