United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4803783 Reopen 4425334: drag in JList requires two mouse gestures
JDK-4803783 : Reopen 4425334: drag in JList requires two mouse gestures

Details
Type:
Bug
Submit Date:
2003-01-15
Status:
Closed
Updated Date:
2003-01-16
Project Name:
JDK
Resolved Date:
2003-01-16
Component:
client-libs
OS:
windows_xp
Sub-Component:
javax.swing
CPU:
x86
Priority:
P4
Resolution:
Duplicate
Affected Versions:
1.4.0
Fixed Versions:

Related Reports
Duplicate:

Sub Tasks

Description

Name: jk109818			Date: 01/15/2003


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)

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


FULL OPERATING SYSTEM VERSION :
Microsoft Windows XP [Version 5.1.2600]

ADDITIONAL OPERATING SYSTEMS :
Should be applicable to all OSs

A DESCRIPTION OF THE PROBLEM :

To drag an object from a JList it is required that the
object is first selected, then, in a second mouse gesture,
dragged. This is contrary to the expected user experience
(e.g. in Windows Explorer) where you can select and drag
in a single gesture. Not that the list selection event
should not be fired until MOUSE UP to enable dragging an
object to another pane that might switch contents due to a
list selection event (c.f. the tree and directory panes of
Windows Explorer).

This is a duplicate of 4425334 which should not have been
closed.

This IS a bug, even if by design! Compare this with Windows, 
where you can click and drag an object in a list which was 
not previously the selection.


STEPS TO REPRODUCE:
1) Compile the below 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.



SOURCE 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() {
		super("BugWithDnDSwing");
		setSize(400,400);
		panel = new JPanel();
		panel.setLayout( null );

		tfDest = new JTextField();
		tfDest.setBounds(150,40,100,20);
		panel.add(tfDest);

		String[] data = {"one", "two", "three", "four"};
		listSource = new JList(data);
		listSource.setBounds(10,40,100,60);
		listSource.setDragEnabled(true);
		panel.add(listSource);

		panel.setVisible(true);
		getContentPane().add(panel);
		setVisible(true);

		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent ae) {
				System.exit(0);
			}
		});
	}

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




REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 178852) 
======================================================================

                                    

Comments
EVALUATION

Closing as a duplicate of the OPEN bug 4521075, one of our most popular vote getters.
###@###.### 2003-01-16
                                     
2003-01-16



Hardware and Software, Engineered to Work Together