Java Code Examples for java.awt.datatransfer.SystemFlavorMap#setNativesForFlavor()

The following examples show how to use java.awt.datatransfer.SystemFlavorMap#setNativesForFlavor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SetNativesForFlavorTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
        final String nativeString = "NATIVE";

        final SystemFlavorMap fm =
            (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();

        fm.setNativesForFlavor(DataFlavor.plainTextFlavor,
                               new String[] { nativeString });

        final java.util.List natives =
            fm.getNativesForFlavor(DataFlavor.plainTextFlavor);

        if (natives.size() != 1 || !natives.contains(nativeString)) {
            throw new RuntimeException("getNativesForFlavor() returns:" +
                                       natives);
        }

        final DataFlavor dataFlavor =
            new DataFlavor("text/unknown; class=java.lang.String");

        fm.setFlavorsForNative(nativeString, new DataFlavor[] { dataFlavor });

        final java.util.List flavors = fm.getFlavorsForNative(nativeString);

        if (flavors.size() != 1 || !flavors.contains(dataFlavor)) {
            throw new RuntimeException("getFlavorsForNative() returns:" +
                                       flavors);
        }
}
 
Example 2
Source File: ImageTransferTest.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
static void leaveFormat(String format) {
    SystemFlavorMap sfm = (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
    sfm.setFlavorsForNative(format, new DataFlavor[]{DataFlavor.imageFlavor});
    sfm.setNativesForFlavor(DataFlavor.imageFlavor, new String[]{format});
}
 
Example 3
Source File: ImageTransferTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
static void leaveFormat(String format) {
    SystemFlavorMap sfm = (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
    sfm.setFlavorsForNative(format, new DataFlavor[]{DataFlavor.imageFlavor});
    sfm.setNativesForFlavor(DataFlavor.imageFlavor, new String[]{format});
}
 
Example 4
Source File: ImageTransferTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
static void leaveFormat(String format) {
    SystemFlavorMap sfm = (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
    sfm.setFlavorsForNative(format, new DataFlavor[]{DataFlavor.imageFlavor});
    sfm.setNativesForFlavor(DataFlavor.imageFlavor, new String[]{format});
}
 
Example 5
Source File: ImageTransferTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
static void leaveFormat(String format) {
    SystemFlavorMap sfm = (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
    sfm.setFlavorsForNative(format, new DataFlavor[]{DataFlavor.imageFlavor});
    sfm.setNativesForFlavor(DataFlavor.imageFlavor, new String[]{format});
}
 
Example 6
Source File: ImageTransferTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
static void leaveFormat(String format) {
    SystemFlavorMap sfm = (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
    sfm.setFlavorsForNative(format, new DataFlavor[]{DataFlavor.imageFlavor});
    sfm.setNativesForFlavor(DataFlavor.imageFlavor, new String[]{format});
}
 
Example 7
Source File: ImageTransferTest.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
static void leaveFormat(String format) {
    SystemFlavorMap sfm = (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
    sfm.setFlavorsForNative(format, new DataFlavor[]{DataFlavor.imageFlavor});
    sfm.setNativesForFlavor(DataFlavor.imageFlavor, new String[]{format});
}
 
Example 8
Source File: ImageTransferTest.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
static void leaveFormat(String format) {
    SystemFlavorMap sfm = (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
    sfm.setFlavorsForNative(format, new DataFlavor[]{DataFlavor.imageFlavor});
    sfm.setNativesForFlavor(DataFlavor.imageFlavor, new String[]{format});
}
 
Example 9
Source File: ImageTransferTest.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
static void leaveFormat(String format) {
    SystemFlavorMap sfm = (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
    sfm.setFlavorsForNative(format, new DataFlavor[]{DataFlavor.imageFlavor});
    sfm.setNativesForFlavor(DataFlavor.imageFlavor, new String[]{format});
}