• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to avoid mouse click event getting called when user press,drag and release the mouse

 
Manju Krishna
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a Jtable component in my UI. I have implemented sorting of columns on click of column header using a Comparator..
The comparator is called in the mouseClicked event.
My problem is.. when we try to resize the column i.e click on the border of columns drag and release... the mouse click event gets fired and that particular column gets sorted...
I dont want this to happen.. This event of dragging and expand the column size must not trigger the mouseClick.. Is there any work around to avoid this??

I also tried giving empty implementation for mousePressed and mouseReleased events....

Please help..
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mouseClicked() only fires if the x,y co-ordinates of mousePressed match those of mouseReleased,
so, if you're going mousePressed/drag/mouseReleased, mouseClicked() should not fire.

if it does, post a small compilable program that demonstartes it.
(just a frame with scrollpane/table and event code, data not required)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!