Java Example Program/ Sample Source Code
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.SystemFlavorMap;
public class GetFlavorsForNatives_SystemFlavorMap {
public static void main(String[] args) throws Exception {
DataFlavor dataFlavor = new DataFlavor("text/plain; charset=ASCII", "Plain ASCII text");
SystemFlavorMap systemFlavorMap = (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
systemFlavorMap.addFlavorForUnencodedNative("native", dataFlavor);
systemFlavorMap.addUnencodedNativeForFlavor(dataFlavor, "native");
SystemFlavorMap.decodeDataFlavor("native");
SystemFlavorMap.decodeJavaMIMEType("native ");
SystemFlavorMap.encodeDataFlavor(dataFlavor);
SystemFlavorMap.encodeJavaMIMEType("text/html");
SystemFlavorMap.getDefaultFlavorMap();
systemFlavorMap.getFlavorsForNative("native");
systemFlavorMap.getFlavorsForNatives(new String[]{"native"});
systemFlavorMap.getNativesForFlavor(dataFlavor);
systemFlavorMap.getNativesForFlavors(new DataFlavor[]{dataFlavor});
SystemFlavorMap.isJavaMIMEType("native");
systemFlavorMap.setFlavorsForNative( "native", new DataFlavor[]{dataFlavor});
systemFlavorMap.setNativesForFlavor(dataFlavor, new String[]{""});
System.out.println("systemFlavorMap "+systemFlavorMap);
}
} |
|
|