-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0
-
hopper
-
x86
-
windows_nt
-
Verified
Name: rmT116609 Date: 01/14/2002
FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)
DESCRIPTION OF THE PROBLEM :
In Jdk1.3.1 I was able to show an option pane in the drop() method (of DropTarget Listener)
and ask for the confirmation from the user before moving the data. There seems to be a
problem in jdk1.4 , the option pane popups up but then the program goes into an infinite
loop (somewhere in the run method of 'sun.awt.windows.WiToolKit') and the user cannot i
interact with the option pane..(the java application uses 100% of the cpu till the application
is terminated by doing an end task) The problem has been introduced in 1.4 and I think the
problem is in the Windows toolkit .I tested it under java 1.4 in Linux and linux works correctly
REGRESSION. Last worked in version 1.3.1, 1.3.1_02.
The problem is reproducible on Windows 2000, Windows NT 4.0 using 1.4.0-beta3, 1.4.0-rc.
The probelm is not reproducible on Solaris 2.8, Linux Redhat 6.1 using 1.4.0-beta3.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) compile and execute the provided source code .
2) When the frame popups click 1 node child node and drag it another child node
3) then an option pane(Confirm Dialog) pops up. Try to click on any of the buttons on the dialog.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected - The user should be able to click on any of the buttons of the Confirm Dialog .
Actual - The user cannot click on any of the buttons of the Option Pane, the program is going into an infinite loop (see the cpu usage)
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.tree.*;
import javax.swing.*;
import java.awt.dnd.*;
import java.awt.*;
import java.awt.datatransfer.*;
public class Test extends JFrame implements DragGestureListener,DropTargetListener, DragSourceListener {
private DefaultTreeModel treeModel;
private JTree tree;
private DragSource ds = new DragSource();
public Test() {
super("Test");
buildTree();
getContentPane().add(new JScrollPane(tree));
setSize(500,500);
show();
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String[] args) {
new Test();
}
private void buildTree() {
TransferTreeNode rootNode = new TransferTreeNode("Root");
rootNode.add(new TransferTreeNode("First"));
rootNode.add(new TransferTreeNode("Second"));
rootNode.add(new TransferTreeNode("Third"));
treeModel = new DefaultTreeModel(rootNode);
tree = new JTree(treeModel);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
ds.createDefaultDragGestureRecognizer(tree, DnDConstants.ACTION_MOVE,this);
new DropTarget(tree,this);
}
/******************************************************************************/
/************************* Drag And Drop Support methods **********************/
/******************************************************************************/
public void dragGestureRecognized(DragGestureEvent e) {
if (e.getDragAction() != DnDConstants.ACTION_MOVE) {
return;
}
Point p = e.getDragOrigin();
TreePath dragPath = tree.getPathForLocation(p.x,p.y);
if (dragPath != null) {
TransferTreeNode treeNode = (TransferTreeNode) dragPath.getLastPathComponent();
e.startDrag(DragSource.DefaultMoveDrop,treeNode,this);
}
}
public void dragDropEnd(DragSourceDropEvent e) {
}
public void dragEnter(DragSourceDragEvent e) {
}
public void dragExit(DragSourceEvent e) {
}
public void dragOver(DragSourceDragEvent e) {
}
public void dropActionChanged(DragSourceDragEvent e) {
}
public void dragEnter(DropTargetDragEvent e) {
}
public void dragExit(DropTargetEvent e) {
}
public void dragOver(DropTargetDragEvent e) {
}
public void dropActionChanged(DropTargetDragEvent e) {
}
public void drop(DropTargetDropEvent e) {
Transferable transferable = e.getTransferable();
int option = JOptionPane.showConfirmDialog(this,"Confirm Move","Confirm Move", JOptionPane.YES_NO_OPTION);
e.dropComplete(true);
}
}
/** The Transferable Object */
class TransferTreeNode extends DefaultMutableTreeNode implements Transferable {
public static final DataFlavor dataFlavor =
new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType,"Test");
private static final DataFlavor[] dataFlavors = {dataFlavor};
public TransferTreeNode(String string) {
super(string);
}
public Object getTransferData(DataFlavor df) {
try {
if(df.equals(dataFlavor)) {
return this;
}
else {
throw new UnsupportedFlavorException(df);
}
}
catch (Exception ex) {
KKClientUtilities.processException(ex);
}
return null;
}
public DataFlavor[] getTransferDataFlavors() {
return dataFlavors;
}
public final boolean isDataFlavorSupported(DataFlavor df) {
return df.equals(dataFlavor);
}
}
---------- END SOURCE ----------
(Review ID: 138250)
======================================================================
- relates to
-
JDK-4683602 creating a DragSource causes a hang in windows 98
-
- Closed
-
-
JDK-5050387 JVM crash when JOptionPane invoked in drop() method
-
- Closed
-