I want to know when JScrollPane is scrolled by user.
I tried to add MouseMotionListener to JScrollPane but it nevers works when I press mouse on scroll bar and drag it.
This causes JScrollPane to scroll but how to grasp this event. mouseDragged is not called when I drag scroll bar.
But my problem is a little different.
When user exits by mouse my jdialog then mouseExited works and hides jdialog.
Unfortunately when scrolling by dragging mouse user might exit jdialog.
This causes mouseExited method to execute and hide the dialog.
The problem is how to tell mouseExited method that user is only autoscrolling by dragging.
By your suggestion I know when scrolling starts but if user stopped scrolling outside jdialog it must be hidden.
Is there a way to know when user ended scrolling by dragging mouse?
You will have to rephrase and tell us what you are trying to do here. Hiding a dialog on mouse exiting is bad usability.
If you are interested in scroll events, where does the mouse drag come into the picture?