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

Detecting double clicks in a JTable  RSS feed

 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi boys and girls,
can anyone tell me how i can detect a double mouse click on a table row?
 
Rene Liebmann
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Pete,
as I know, it is only possible to listen for a mouse click in a cell, not in a row. But this is not the problem, because a cell knows, in which row it is. So you need a custom TableCellRenderer. There you add a MouseListener and you listen for mouseClicked. The MouseEvent you can ask for getClickCount().
This way I would try to go.
Another way could be to add a mouse listener to the table. Listen for the mouseClicked event and ask for the click count too. Then you ask the table, which row is selected. Then you can do what you want.
Hope this helps
Rene
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To put the previous words into code:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!