Duplicate :
|
Dispatch contract for MOUSE_DRAGGED events is violated when mouse wheel is used on Linux. As per contract, described in javadoc for java.awt.event.MouseEvent class, MOUSE_DRAGGED events are delivered to the Component in which the mouse button was pressed until the mouse button is released (regardless of whether the mouse position is within the bounds of the Component). This is not true on Linux platform, when mouse wheel is used during drag process. As a consequence, auto scrolling behavior of Swing components (as described in javadoc for JComponent.setAutoscrolls (boolean) method) differs from expected. To reproduce the issue, launch the attached sample program, then perform the following steps: 1) Scroll the text area to the very right, so that the trailing portion of text is displayed. 2) Start text selection, by pressing left mouse button and dragging it to the left. 3) Continue dragging until mouse pointer is over 'Side label'. 4) Use mouse wheel (while still holding left mouse button). 5) Continuing to hold mouse button drag mouse pointer back to text area region. 6) Release mouse button. Expected result auto scrolling of text area stops. Actual result - it continues till scrolling reaches the beginning of text. The issue is reproduced on Ubuntu 14.04 using latest Java 8 version: java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) Client VM (build 25.45-b02, mixed mode) The issue seems to be a regression, as the issue is Not reproduced using Java 1.6.0_45. The issue seems to be related to the existing OpenJDK bug - @ https://bugs.openjdk.java.net/browse/JDK-8041470. The issue causes problems for customers using our application on Linux when they use mouse dragging and mouse wheel scrolling to create selection in text components.