JDK-4380088 : Cannot drag and drop multiple items
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.2,1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic,windows_nt,windows_2000
  • CPU: generic,x86
  • Submitted: 2000-10-17
  • Updated: 2003-07-08
  • Resolved: 2003-07-08
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description

Name: skT45625			Date: 10/17/2000


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

I'm using DnD in several lists and trees and ran across the problem that I
cannot drag and drop more than one item at a time.  I posted a message to your
forums and came to the conclusion that there is no fix and I discovered that
many more people ran into this same problem as far back as a year ago.  Here is
a quick analysis I posted to your swing forum ((1) is swing, (2) is awt):

(1) The mouse listeners for lists and trees (and tables for that
matter) select an item on the mouse down (left button, no
modifiers).  This is a major nuisance during dragging since if
you have a multiple selection and want to drag this multiple
selection, you can't because it turns into a single selection as
soon as your mouse button goes down.  The solution would be to
carefully craft the behavior such that for a simple selection
(left button, no modifiers) the selection is not done until the
mouse up.  But that would require rewriting the mouse listener
in BasicListUI etc., which I'm not about to do (as far as I know
there is no easy way to replace functionality like that because
you end up replacing the UI, in which case you also lose the
specializations like MetalListUI).

(2) In lieu of rewriting the mouse listener mentioned above, you
would expect that pressing the shift button and initiating a
drag, but alas this does not work as the platform-specific
DragGestureRecognizer refuses to initiate a drag with a shift
button down (at least on Windows).  Since these
DragGestureRecognizers are peeled through the platform-specific
  ToolKit, I can't easily replace that one either (there is no
source code for the recognizers).

Thanks,

	-Jaap-

PS: Using Control + Shift together does work up to a point, but alters the
drag&drop operation and is not very intuitive.  It also toggles the selected
  state of the last item you click on, which makes it even less desirable.  I
elected not to pursue this alternative.
(Review ID: 110978) 
======================================================================

Comments
WORK AROUND Name: skT45625 Date: 10/17/2000 None that I know of. ======================================================================
11-06-2004

EVALUATION Might be addressed by some the Swing DnD work in merlin. Otherwise, will consider for tiger. david.mendenhall@east 2001-03-19 Name: agR10216 Date: 07/04/2003 The only AWT multiple-selection component is List. It's possible to start drag with several items selected in a list. Though it's not very convenient on Windows because one have to select a last item he/she wants to drag with pressing a mouse button and drag the mouse without releasing the button. A bug might be filed on this particular issue. There are a lot of multiple-selection components in Swing, besides Swing uses it's own drag gesture recognizers, therefore this bug should be recategorized to Swing. ###@###.### 2003-07-04 ====================================================================== We encourage you to use Swing's DnD support, which allows you to enable special selection semantics appropriate for drag and drop. I'm closing this bug out as a duplicate of that. ###@###.### 2003-07-08
08-07-2003