JDK-8178361 : JFileChooser does not allow to open folders by a double tap on a touch screen
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7,8,9,10,11,12,13
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2017-03-29
  • Updated: 2023-11-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Blocks :  
Description
FULL PRODUCT VERSION :
JDK 8u121

ADDITIONAL OS VERSION INFORMATION :
MS Windows 10 OS, MS Windows 8.1 OS on a Surface Pro 3

A DESCRIPTION OF THE PROBLEM :
In "javax.swing.JFileChooser" component folders cannot be opened by double tapping with a finger or with a touch pen on the touch screen.

Folders can be opened by double clicking using a regular mouse or a trackpad.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should be possible to open folders in "JFileChooser" by double tapping on a touch screen.

REPRODUCIBILITY :
This bug can be reproduced always.
Comments
Observed that at "FilePane.java" mouseClicked handler receiving for double tap generating MOUSE_PRESSED event with clickCount=2 and MOUSE_CLICKED fired only for first click. Same scenario with mouse double click generating MOUSE_PRESSED and MOUSE_CLICKED with clickCount=2. Observed reason for missing 2nd click during tap : Windows is generating 'WM_MOUSEMOVE' event between touches and that internally considering as drag. At 'awt_Component.cpp' as part of 6404008 fix in case of drag 'Clicked event' will be skipped.
07-11-2023

retargeted as no activity on this bug so far
10-06-2019

[~alitvinov] as a reminder this Thu, Jan 17 is a deadline (JDK 12 RDP2) for P3s, after this date it will be retargeted to "13"
14-01-2019

Setting the issue type back to "Bug", because the basic touch screen support existed in JDK always through relying on default translation of window messages related to touch events to window messages related to mouse events by OS. Decreasing the priority of the bug to P3, based on ILW=MHL.
29-11-2018

Reminder: Dec 13 is a deadline (JDK 12 RDP1) to push a code of Enhancement into mainstream repo before JDK 12 repo fork
27-11-2018

The root cause of the bug is defined. It is practically proven that this bug is not caused by, how the touch input is supported by JDK, it is a bug in JDK. JDK is capable of handling the double tap events without any changes involving touch input API. THE ROOT CAUSE OF THE BUG: The event "java.awt.event.MouseEvent.MOUSE_CLICKED" is not sent from the native method "AwtComponent::WmMouseUp" to the event queue for "WM_LBUTTONUP" message related to the second touch (tap) of the double touch user action. Tracing shows that in reality: 1. During a double click and a double touch "AwtComponent" window always receives 2 pairs of "WM_LBUTTONDOWN/WM_LBUTTONUP" messages, thus JDK already has support of the double touch action via "WM_LBUTTONDOWN/WM_LBUTTONUP" messages. 2.1. For each "WM_LBUTTONDOWN" in "AwtComponent::WmMouseDown" JDK sends 1 "java.awt.event.MouseEvent" (MOUSE_PRESSED). 2.2. For each "WM_LBUTTONUP" in "AwtComponent::WmMouseUp" JDK sends 2 "java.awt.event.MouseEvent" (MOUSE_RELEASED, MOUSE_CLICKED). However, when the double touch is done "MOUSE_CLICKED" event is not sent for "WM_LBUTTONUP" from the 2nd pair of "WM_LBUTTONDOWN/WM_LBUTTONUP" messages, because "m_mouseButtonClickAllowed" equals "0" and the next condition in "AwtComponent::WmMouseUp" is not satisfied: if ((m_mouseButtonClickAllowed & GetButtonMK(button)) != 0) { //CLICK allowed SendMouseEvent(java_awt_event_MouseEvent_MOUSE_CLICKED, ::JVM_CurrentTimeMillis(NULL, 0), x, y, GetJavaModifiers(), clickCount, JNI_FALSE, GetButton(button)); } It occurs, because between the 2nd pair of the messages "WM_LBUTTONDOWN/WM_LBUTTONUP" the messages "WM_MOUSEMOVE" arrive, so "x", "y" coordinates of "WM_LBUTTONDOWN", "WM_LBUTTONUP" are different. JDK handles "WM_MOUSEMOVE", and in "AwtComponent::WmMouseMove" this event is treated as "dragging" and the next expression is executed. "m_mouseButtonClickAllowed = 0;" Therefore in "AwtComponent::WmMouseUp" it is decided not to send "java.awt.event.MouseEvent.MOUSE_CLICKED" and treat that "WM_LBUTTONUP" as the end of dragging.
03-10-2017

Reproduced the issue and the corresponding software changes implemented to fix this problem are under review.
18-09-2017

It's seem to be an enhancement to support touch screen events. Also, event support need to be added in awt so I am putting it as an enhancement for awt.
13-06-2017

Checked with JDK 7 and 7u80 as well and confirmed that it does fail there as well. Updating the affected version.
01-06-2017

[~pardesha] Since you tested with different jdk version, I am asking whether you tested if it passes with jdk7 or earlier too or does it started failing from jdk8 ea onwards?
24-04-2017

Not reproducible on Windows 7 x64 with JDK9-ea-165 using mouse/trackpad.
12-04-2017

It's failing with 9 b164 on Windows 10 pro Unable to open a folder by touch screen but able to open a folder by double mouse click
12-04-2017

Checked this on Windows 10 Pro with touch support and could confirm the issue as reported. Result: 8 b132: FAIL 8u121 b13 - FAIL 9 ea b163: FAIL 8u152 ea b02: FAIL To verify, run the attached test case with respective JDK version.
10-04-2017