-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
1.2.2, 1.3.0
-
generic, x86
-
generic, windows_nt, windows_2000
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)
======================================================================
- duplicates
-
JDK-4290983 Drag and Drop Support for Swing Components
-
- Resolved
-
- relates to
-
JDK-4521075 Drag gesture in JAVA different from Windows
-
- Resolved
-
-
JDK-4801246 JTree should fire selection change notice on mouse up
-
- Closed
-
-
JDK-4817070 Must select in JTable then release mouse button before able to drag and drop.
-
- Closed
-