Java Example Program/ Sample Source Code
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.FlavorMap;
import java.util.HashMap;
import java.util.Map;
public class FlavorMapExample implements FlavorMap {
@Override
public Map<DataFlavor, String> getNativesForFlavors(DataFlavor[] flavors) {
Map<DataFlavor, String> nativesMap = new HashMap<DataFlavor, String>();
DataFlavor dataFlavor = new DataFlavor(java.awt.TextField.class,
"AWT TextField");
nativesMap.put(dataFlavor, "dataFlavor");
return nativesMap;
}
@Override
public Map<String, DataFlavor> getFlavorsForNatives(String[] natives) {
Map<String, DataFlavor> nativesMap = new HashMap<String, DataFlavor>();
DataFlavor dataFlavor = new DataFlavor("text/plain; charset=ASCII", "Plain ASCII text");
nativesMap.put("dataFlavor",dataFlavor);
return nativesMap;
}
} |
|
|