-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
beta
-
sparc
-
solaris_2.6
Name: tb29552 Date: 11/10/98
/*
The simple test program appended at the end of
this message generates a
NullPointerException when dragging is started, if
run under Motif (Solaris 2.6 sparc). It runs with
no error if run under Windows NT.
In both cases, we are using 1.2-rc1.
Here is the trace:
java.lang.NullPointerException
at sun.awt.motif.MDragSourceContextPeer.startDrag(Compiled Code)
at java.awt.dnd.DragSource.startDrag(Compiled Code)
at java.awt.dnd.DragSource.startDrag(Compiled Code)
at java.awt.dnd.DragGestureEvent.startDrag(Compiled Code)
at DnDtest.dragGestureRecognized(Compiled Code)
at java.awt.dnd.DragGestureRecognizer.fireDragGestureRecognized(Compiled Code)
at sun.awt.motif.MMouseDragGestureRecognizer.mouseDragged(Compiled Code)
at java.awt.Component.processMouseMotionEvent(Compiled Code)
at java.awt.Component.processEvent(Compiled Code)
at java.awt.Container.processEvent(Compiled Code)
at java.awt.Window.processEvent(Compiled Code)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Container.dispatchEventImpl(Compiled Code)
at java.awt.Window.dispatchEventImpl(Compiled Code)
at java.awt.Component.dispatchEvent(Compiled Code)
at java.awt.EventQueue.dispatchEvent(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)
java.awt.dnd.InvalidDnDOperationException: The operation requested cannot be performed by the DnD system since it is not in the appropriate state
at sun.awt.motif.MDragSourceContextPeer.startDrag(Compiled Code)
at java.awt.dnd.DragSource.startDrag(Compiled Code)
at java.awt.dnd.DragSource.startDrag(Compiled Code)
at java.awt.dnd.DragGestureEvent.startDrag(Compiled Code)
at DnDtest.dragGestureRecognized(Compiled Code)
at java.awt.dnd.DragGestureRecognizer.fireDragGestureRecognized(Compiled Code)
at sun.awt.motif.MMouseDragGestureRecognizer.mouseDragged(Compiled Code)
at java.awt.Component.processMouseMotionEvent(Compiled Code)
at java.awt.Component.processEvent(Compiled Code)
at java.awt.Container.processEvent(Compiled Code)
at java.awt.Window.processEvent(Compiled Code)
at java.awt.Component.dispatchEventImpl(Compiled Code)
at java.awt.Container.dispatchEventImpl(Compiled Code)
at java.awt.Window.dispatchEventImpl(Compiled Code)
at java.awt.Component.dispatchEvent(Compiled Code)
at java.awt.EventQueue.dispatchEvent(Compiled Code)
at java.awt.EventDispatchThread.run(Compiled Code)
------------------------------------------
*/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
import java.awt.dnd.*;
import java.awt.dnd.peer.*;
public class DnDtest extends JFrame implements DragGestureListener, DragSourceListener {
public DnDtest () {
JComponent content = (JComponent) getContentPane();
content.setLayout(new FlowLayout());
content.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
content.setBackground(Color.white);
JButton close = new JButton("Close");
close.setMaximumSize(close.getPreferredSize());
close.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
setVisible(false);
dispose();
}
});
content.add(close);
DragSource source = DragSource.getDefaultDragSource();
DragGestureRecognizer dgc = source.createDefaultDragGestureRecognizer(
this, DnDConstants.ACTION_COPY, this);
}
//
// DragGestureListener interface
//
public void dragGestureRecognized(DragGestureEvent evt) {
StringSelection data = new StringSelection("some data");
try {
evt.startDrag(DragSource.DefaultCopyNoDrop, data, this);
} catch(Exception e) {
e.printStackTrace();
System.exit(0);
}
}
//
// DragSourceListener interface
//
public void dragEnter(DragSourceDragEvent drag) {
System.err.println("enter");
}
public void dragOver(DragSourceDragEvent drag) {
System.err.println("over");
}
public void dropActionChanged(DragSourceDragEvent drag) {
System.err.println("action changed");
}
public void dragExit(DragSourceEvent evt) {
System.err.println("exit");
}
public void dragDropEnd(DragSourceDropEvent drop) {
System.err.println("drop end");
}
static public void main(String[] args) {
final JFrame myself = new DnDtest ();
myself.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
myself.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent evt) {
System.exit(0);
}
});
myself.pack();
myself.show();
}
}
(Review ID: 42449)
======================================================================
- relates to
-
JDK-4404631 Regression: test/java/awt/dnd/DnDAcceptanceTest crashes on Solaris
-
- Closed
-