Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable click sometimes ignored  RSS feed

 
marc bowden
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I have a JTable in a JFrame. There's 4 rows displayed
in the JTable. When I click on a row I use a mouse listener
and I display the value in one of the columns. 8 times out
of ten the listener code is invoked and I see the display. Sometimes however I click on a row and it's as if the click has not occured. I click again, and it's ok.
Marc
 
Amit Agarwal
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi marc,
If you are using the mouseClicked() method of the mouse listener, this problem can occour, as the slightest movement of the mouse can result in a mouse drag and not a click. you should use mousePressed() instead. This should solve your problem.
Regards,
Amit
 
marc bowden
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amit
Thanks very much!!
Marc
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!