-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
sparc
-
solaris_2.5.1
Name: sdC67446 Date: 08/04/99
The method:
public static final DataFlavor
selectBestTextFlavor(DataFlavor[] availableFlavors)
of class java.awt.datatransfer.DataFlavor
returns different "best" DataFlavors for equal arrays of
DataFlavors. See the example.
The specification should clearly clarify how "the best (highest
fidelity) flavor" looks like.
The doc says:
--------------------------------------------------
public static final DataFlavor
selectBestTextFlavor(DataFlavor[] availableFlavors)
Returns:
the best (highest fidelity) flavor in an encoding supported
by the JDK, or null if none can be found.
---------Test.java--------------------------------
import java.awt.datatransfer.DataFlavor;
public class Test {
public static void main(String[] args) {
try {
DataFlavor df = new DataFlavor();
DataFlavor dfs1[] = {new DataFlavor("text/plain"),
DataFlavor.stringFlavor};
DataFlavor dfs2[] = {DataFlavor.stringFlavor,
new DataFlavor("text/plain")};
System.out.println(df.selectBestTextFlavor(dfs1));
System.out.println(df.selectBestTextFlavor(dfs2));
} catch (Exception e) {
e.printStackTrace();
}
}
}
---------Output-----------------------------------
Classic VM (build JDK-1.3-L, green threads, nojit)
Warning: JIT compiler "sunwjit" not found. Will use interpreter.
java.awt.datatransfer.DataFlavor[representationclass=java.io.InputStream;mimetype=text/plain]
java.awt.datatransfer.DataFlavor[representationclass=java.lang.String;mimetype=application/x-java-serialized-object]
--------------------------------------------------
======================================================================
- duplicates
-
JDK-4259468 DataFlavor.selectBestTextFlavor behavior is not defined
- Closed
-
JDK-4275210 selectBestFlavor is not returning the same dataflavor every time
- Closed
- relates to
-
JDK-4313838 Win&Sol Japanese:DnD from native app doesn't work with selectBestTextFlavor
- Closed