new DataFlavor(String mimeType, String humanPresentableName) : DataFlavor « java.awt.datatransfer « Java by API






new DataFlavor(String mimeType, String humanPresentableName)

/*
Mime type: application/x-java-serialized-object; class=java.awt.Button
Primary type: application
Subtype: x-java-serialized-object
Name: AWT Button
Representation class: class java.awt.Button

df1 equals df2: false
*/
import java.awt.datatransfer.DataFlavor;

public class MainClass {

  public static void main(String[] args) {

    DataFlavor df1 = new DataFlavor("text/plain; charset=ASCII", "Plain ASCII text");

    DataFlavor df2 = new DataFlavor(java.awt.Button.class, "AWT Button");

    System.out.println("Mime type: " + df2.getMimeType());
    System.out.println("Primary type: " + df2.getPrimaryType());
    System.out.println("Subtype: " + df2.getSubType());
    System.out.println("Name: " + df2.getHumanPresentableName());
    String s = df2.getRepresentationClass().toString();
    System.out.println("Representation class: " + s + "\n");

    System.out.println("df1 equals df2: " + df1.isMimeTypeEqual(df2));
  }
}

           
       








Related examples in the same category

1.DataFlavor.javaFileListFlavor
2.DataFlavor.stringFlavor
3.new DataFlavor(Class representationClass, String humanPresentableName)
4.DataFlavor: getHumanPresentableName()
5.DataFlavor: getMimeType()
6.DataFlavor: getParameter(String paramName)
7.DataFlavor: getPrimaryType()
8.DataFlavor: getRepresentationClass()
9.DataFlavor: getSubType()
10.DataFlavor: isMimeTypeEqual(DataFlavor dataFlavor)