Java Swing Tutorial - Java DataFlavor .isMimeTypeEqual (String mimeType)


DataFlavor.isMimeTypeEqual(String mimeType) has the following syntax.

public boolean isMimeTypeEqual(String mimeType)


In the following code shows how to use DataFlavor.isMimeTypeEqual(String mimeType) method.

import java.awt.datatransfer.DataFlavor;
//from ww  w.  j av  a 2 s . co m
public class Main {

  public static void main(String[] args) {

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

    System.out.println("df1 equals df2: " + df1.isMimeTypeEqual("Plain ASCII text"));

The code above generates the following result.