JDK-4425334 : Unable to drag from JList, if mouse btn not released till it's dropped on target
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P2
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2001-03-14
  • Updated: 2001-04-13
  • Resolved: 2001-04-12
Related Reports
Relates :  
Unable to drag and drop a selected item from JList, if mouse button is not released till it's dropped on the target.

% java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b55)
Java HotSpot(TM) Client VM (build 1.4beta-B55, mixed mode)

Sample testcase code :

import javax.swing.*;
import javax.swing.plaf.basic.*;

import java.awt.*;
import java.awt.event.*;
import java.util.*;

public class BugWithDnDSwing extends JFrame {

	JPanel panel;

	private JTextField tfSource;
	private JTextField tfDest;

	private JList listSource;
	private JList listDest;

	public BugWithDnDSwing() {
		panel = new JPanel();
		panel.setLayout( null );

		tfDest = new JTextField();

		String[] data = {"one", "two", "three", "four"};
		listSource = new JList(data);


		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent ae) {

	public static void main(String[] args) {
		new BugWithDnDSwing();

To reproduce :

1) Compile the above code and execute it.
2) Press LEFT mouse button on a non-selected item of JList.
3) Start dragging without releasing the mouse button.

You will see that nothing gets dragged.

NOTE : This is reproducible on all platforms.

PUBLIC COMMENTS It is still reproducible.

EVALUATION This was a regression caused by 4403474. I discovered this (and fixed it) while fixing 4416547. JList, JTree, JTable, and JFileChooser were all broken because they depended upon the bug in TransferHandler of always returning COPY as the source action. The various TransferHandler implementations in the basic package now implement getSourceActions to return COPY which properly reflects their capabilities. The fix has already been integrated in yesterdays integration so I'm marking this integrated. timothy.prinzing@eng 2001-03-14 Moving the status to fixed as dragging from a JList works fine for me, and we are integrating today. I'm certain this was already integrated though. timothy.prinzing@eng 2001-03-27 Apparently the actual regression wasn't noticed. After reading the description of the bug again I see the report did not describe a bug in the first place. To initiate a drag, you must press over a SELECTED item and drag a few pixels before a drag gesture is recognized. timothy.prinzing@eng 2001-04-12