Java Code Examples for java.awt.datatransfer.DataFlavor#match()

The following examples show how to use java.awt.datatransfer.DataFlavor#match() . 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: DefaultMatchTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    boolean passed = true;
    try {
        df1 = new DataFlavor("application/postscript");
        df2 = new DataFlavor();
        df3 = new DataFlavor();
    } catch (ClassNotFoundException e1) {
        throw new RuntimeException("Could not create DataFlavors. This should never happen.");
    } catch (IllegalArgumentException e2) {
        passed = false;
    }
    try {
        boolean b;
        b = df1.match(df2);
        b = df2.match(df1);
        b = df2.match(df3);
    } catch (NullPointerException e) {
        throw new RuntimeException("The test FAILED: DataFlavor.match still throws NPE");
    }
    if (!passed) {
        throw new RuntimeException("Test FAILED");
    }
    System.out.println("Test PASSED");
}
 
Example 2
Source File: ReaderForUnicodeText.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
    if (flavor.match(DataFlavor.plainTextFlavor)) {
        return true;
    }
    return false;
}
 
Example 3
Source File: DataTableColumnCollectionTransferable.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
	if (flavor.match(DataTableColumnCollection.DATATABLE_COLUMN_COLLECTION_FLAVOR)) {
		return true;
	}
	return false;
}
 
Example 4
Source File: ValueSourceTreeNode.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
	if (flavor.match(VALUE_SOURCE_FLAVOR)) {
		return true;
	}
	return false;
}
 
Example 5
Source File: RangeAxisConfigTreeNode.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public boolean isDataFlavorSupported(DataFlavor flavor) {
	if (flavor.match(RANGE_AXIS_CONFIG_FLAVOR)) {
		return true;
	}
	return false;
}
 
Example 6
Source File: SimpleTransferable.java    From swing_library with MIT License 5 votes vote down vote up
public boolean isDataFlavorSupported(DataFlavor flavor) {
	for (int i = 0; i < flavors.length; i++) {
		if (flavor.match(flavors[i])) {
			return true;
		}
	}
	return false;
}