JDK-4912842 : double-click selection performs too slowly
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_nt
  • CPU: x86
  • Submitted: 2003-08-26
  • Updated: 2013-11-01
  • Resolved: 2003-09-26
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
5.0 tigerFixed
Related Reports
Relates :  
Relates :  
Description
This is more of a semantic issue than a strictly performance issue, but with the current semantics of double-click selection in Swing it becomes a performance issue.

The problem is that native apps (on multiple platforms; I have seen the same semantics on Windows, Solaris, and Linux) perform a double-click action on the second mouse PRESS action.  Swing, on the other hand, performs a double-click action on the second mouse RELEASE action.

I originally thought that the problem was in AWT; perhaps they were not sending the correct event at the correct time.  But it is now clear that AWT does not define these semantics; they simply forward the events and let the client (Swing, in this case) decide what to do with them.   Also, I wrote a simple app that showed that Awt running on Windows uses the native Windows selection semantics (second mouse press).

The result of this difference between PRESS and RELEASE is a delay in selection that is noticeable to the user; I timed this additional time (between the mouse
press and mouse release during a simple double-click) at between 70 and 100 ms on average.

I have attached a test app TextSelection.java that shows the difference between Awt and Swing selection.  To see the difference, double-click in one of the awt text fields, but hold the mouse on the second click; note that the text is selected on this 2nd mouse press action.  Now do the same in the Swing text fields; note that the text is not selected until you finally release the mouse.
Now note the timings; I print out some simple information when interacting with the Swing frame regarding the time and 
highlighter (hacky, but I use the highlighter info to detect when the text is actually selected).  Note the time between the second mousePressed and mouseReleased; this is the additional time that it takes for Swing to select text versus a native app (or Awt, for that matter).

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b22
14-06-2004

EVALUATION we are going to implement click and press selection keeping double click selection at the same time for compatibility reasons. Here is the logic click and press - do the selection double click - if selection was not handled on the previous step do the selection
11-06-2004