JDK-4291756 : 1.3FCS_O:Dragging text from an external application to Java application FAILED
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.3.0
  • Priority: P2
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 1999-11-16
  • Updated: 1999-11-22
  • Resolved: 1999-11-22
Related Reports
Relates :  
Relates :  
Relates :  
Description
Kestrel fcs_O on Win32 and Solaris;

Java application can not accept dragging text from an external application,
such as Word Pad on win32 or Text Editor on solaris.

Only on Win98 it is accepted, but the text can not be displayed correctly.

By fcs_N drag-drop from external applications into Java application works fine.


To reproduce,

1. Compile and run the attached program.
2. Drag text into the text area from WordPad on win32 or Text Editor on solaris.

On win95,NT, Solaris dragging can not be accepted.
On win98, dragging can be accepted, but displayed incorrectly in TextArea.


It seems that the dragging problem is related to 4286750 which is for
DataFlavor.equals(Object).
4286750, "cannot drag text from a Java application to drop into an external
application" is the problem by the opposite way.



Comments
EVALUATION This is a problem with the test case. I ran the test on Solaris and saw the following output: [Target]-dragEnter Source Actions = 3 DataFlavor[] Count = 3 MIMEType[0]=text/plain; class=java.io.InputStream; charset=iso8859-1 MIMEType[1]=text/plain; class=java.io.InputStream; charset=unknown MIMEType[2]=text/plain; class=java.io.InputStream; charset=X11-COMPOUND_TEXT Reject the drag!! [Target]-dragExit The testcase is looking for text data using DataFlavor.equals(DataFlavor.plainTextFlavor). This is a bad idea because it restricts the charset of the incoming text to Unicode. In addition, DataFlavor.plainTextFlavor will soon be deprecated. The test case should be rewritten as follows: In dragEnter(DropTargetDragEvent), the array of supported DataFlavors should be passed to DataFlavor.selectBestTextFlavor. If non-null is returned, then the drag can be accepted. In drop(DropTargetDropEvent), DataFlavor.selectBestTextFlavor should again be used to get the highest fidelity text flavor. Then, getReaderForText should be called on this DataFlavor. david.mendenhall@eng 1999-11-22
22-11-1999