Name: sv35042 Date: 10/18/2002
FULL PRODUCT VERSION :
java version "1.4.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-
b03)
Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
FULL OPERATING SYSTEM VERSION : Microsoft Windows 2000 [Version
5.00.2195]
A DESCRIPTION OF THE PROBLEM :
When dragging a file out of a JFileChooser, the file must first be
selected. Selecting a file and dragging does not initiated a drag-and-drop
operation.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Show a JFileChooser
2. Select a file, and without releasing the mouse
button, try to drag it.
3. DnD operation not started
EXPECTED VERSUS ACTUAL BEHAVIOR :
It should be possible to begin a drag without having to 1) select the file
with a mouse click, and then 2) click the file again and drag.
This is a
semi-major usability issue for end-users, as this is behaviour deviates
from expected drag-and-drop functionality.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
(any application showing a JFileChooser can be used)
Analysis:
This behaviour is due to
the MouseInputHandler in the BasicListUI. It allows the user to click-and-drag to change the
selection. During this operation, JList.setValueIsAdjusting() is set to true. The
BasicJFileChooserUI uses a JList to show the list of files. When the TransferHandlers
createTransferable() is called, the selection of the JList hasn't been updated yet, due to
valueIsAdjusting being true.
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Create a custom TransferHandler that sets valueIsAdjusting to false
before querying the selection, or use a custom ListUI that doen't change
the selection while dragging.
(Review ID: 153980)
======================================================================