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

The following examples show how to use java.awt.datatransfer.SystemFlavorMap#encodeJavaMIMEType() . 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: GetNativesForNewFlavorTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void initMappings() throws Exception {
    //initialize mapping variables used in this test
    //create a DataFlavor from Button class
    test_flavor1 = new DataFlavor(Class.forName("java.awt.Button"), "Button");

    //create an Encoded String native using Button class MIME Type
    String buttonMIME = test_flavor1.getMimeType();
    test_encoded = SystemFlavorMap.encodeJavaMIMEType(buttonMIME);

    //create a DataFlavor from the Encoded String native
    test_flavor2 = SystemFlavorMap.decodeDataFlavor(test_encoded);

    //create and initialize DataFlavor arrays
    test_flavors_set = new DataFlavor[] {test_flavor1};

    //create and initialize String native arrays
    test_natives_set = new String[] {test_encoded};
}
 
Example 2
Source File: GetFlavorsForNewNativeTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void initMappings() throws Exception {
   //initialize mapping variables used in this test
  //create an Unencoded String native
  test_native1 = "TEST1";

  //create a DataFlavor from Button class
  test_flavor1 = new DataFlavor(Class.forName("java.awt.Button"), "Button");

  //create an Encoded String native using Button class MIME Type
  String buttonMIME = test_flavor1.getMimeType();
  test_encoded = SystemFlavorMap.encodeJavaMIMEType(buttonMIME);

  //create a DataFlavor from the Encoded String native
  test_flavor2 = SystemFlavorMap.decodeDataFlavor(test_encoded);

  //create and initialize DataFlavor arrays
  test_flavors_set = new DataFlavor[] {test_flavor2};

  //create and initialize String native arrays
  test_natives_set = new String[] {test_encoded};
}