Example usage for java.awt.datatransfer SystemFlavorMap addUnencodedNativeForFlavor

List of usage examples for java.awt.datatransfer SystemFlavorMap addUnencodedNativeForFlavor

Introduction

In this page you can find the example usage for java.awt.datatransfer SystemFlavorMap addUnencodedNativeForFlavor.

Prototype

public synchronized void addUnencodedNativeForFlavor(DataFlavor flav, String nat) 

Source Link

Document

Adds a mapping from the specified DataFlavor (and all DataFlavor s equal to the specified DataFlavor ) to the specified String native.

Usage

From source file:ec.util.chart.swing.Charts.java

private static DataFlavor registerSystemFlavor(String nat, String mimeType, String humanPresentableName) {
    DataFlavor result = null;//from w ww  . j a  v a 2s. c om
    try {
        result = SystemFlavorMap.decodeDataFlavor(nat);
    } catch (ClassNotFoundException ex) {
    }
    if (result == null) {
        result = new DataFlavor(mimeType, humanPresentableName);
        SystemFlavorMap map = (SystemFlavorMap) SystemFlavorMap.getDefaultFlavorMap();
        map.addUnencodedNativeForFlavor(result, nat);
        map.addFlavorForUnencodedNative(nat, result);
        return result;
    }
    return result;
}