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

The following examples show how to use java.awt.datatransfer.DataFlavor#javaJVMLocalObjectMimeType() . 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: TreeTransferable.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private static DataFlavor createLocalTreeNodeFlavor() {
    try {
        return new GenericDataFlavor(
            DataFlavor.javaJVMLocalObjectMimeType+
            "; class=java.util.ArrayList", 
            "Local list of Tree Nodes");
    }catch (Exception e) {
        Msg.showError(TreeTransferable.class, null, null, null, e);
    }
    return null;
}
 
Example 2
Source File: GroupTransferable.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private static DataFlavor createLocalGroupFlavor() {
    try {
        return new DataFlavor(
            DataFlavor.javaJVMLocalObjectMimeType+
            "; class="+Group.class.getName(), 
            "Local Group");
        
    }catch (Exception e) {
        Msg.showError(GroupTransferable.class, null, null, null, e);
    }
    return null;
}
 
Example 3
Source File: TransferableTreeNode.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Returns the Java JVM LocalObject Flavor.
 */
public static DataFlavor getJavaJVMLocalObjectFlavor() {
	if (TransferableTreeNode.javaJVMLocalObjectFlavor == null) {
		try {
			TransferableTreeNode.javaJVMLocalObjectFlavor = new DataFlavor(
					DataFlavor.javaJVMLocalObjectMimeType);
		} catch (ClassNotFoundException cnfe) {
			System.err.println("Cannot create JVM Local Object Flavor "
					+ cnfe.getMessage());
		}
	}
	return TransferableTreeNode.javaJVMLocalObjectFlavor;
}
 
Example 4
Source File: LastNodeLowerHalfDrop.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public TreeTransferHandler() {
    try {
        String mimeType = DataFlavor.javaJVMLocalObjectMimeType
                + ";class=\""
                + javax.swing.tree.DefaultMutableTreeNode[].class.getName()
                + "\"";
        nodesFlavor = new DataFlavor(mimeType);
        flavors[0] = nodesFlavor;
    } catch (ClassNotFoundException e) {
        System.out.println("ClassNotFound: " + e.getMessage());
    }
}
 
Example 5
Source File: MockComponentTransferable.java    From pumpernickel with MIT License 5 votes vote down vote up
public MockComponentTransferable(MockComponent mc) {
	try {
		myDataFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType);
	} catch (ClassNotFoundException e) {
		RuntimeException e2 = new RuntimeException();
		e2.initCause(e);
		throw e2;
	}
	this.mockComponent = mc;
}
 
Example 6
Source File: DesktopFilterDragAndDropSupport.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public DataFlavor[] getTransferDataFlavors() {
    String mimeType = DataFlavor.javaJVMLocalObjectMimeType +
            ";class=\"" +
            AbstractCondition.class.getName() +
            "\"";

    DataFlavor[] dataFlavors = new DataFlavor[1];
    try {
        dataFlavors[0] = new DataFlavor(mimeType);
    } catch (Exception e) {
        log.error(ExceptionUtils.getStackTrace(e));
    }
    return dataFlavors;
}
 
Example 7
Source File: CardTransfertHandler.java    From MtgDesktopCompanion with GNU General Public License v3.0 5 votes vote down vote up
public CardTransfertHandler() {

		localObjectFlavor = new ActivationDataFlavor(DisplayableCard.class, DataFlavor.javaJVMLocalObjectMimeType,"DisplayableCard");
		window.add(dragLab);
		window.setBackground(new Color(0, true));

		DragSource.getDefaultDragSource().addDragSourceMotionListener(dsde -> {
			Point pt = dsde.getLocation();
			pt.translate(5, 5);
			window.setLocation(pt);
			window.setVisible(true);
			window.pack();
		});
	}
 
Example 8
Source File: DnDTools.java    From wandora with GNU General Public License v3.0 5 votes vote down vote up
public static <K> WrapperDataFlavor makeDataFlavor(Class<K> cls){
    try{
        return new WrapperDataFlavor<>(DataFlavor.javaJVMLocalObjectMimeType+";class="+cls.getName(),cls);
    }catch(ClassNotFoundException cnfe){
        throw new RuntimeException(cnfe);
    }
}
 
Example 9
Source File: SymbolTreeDataFlavor.java    From ghidra with Apache License 2.0 4 votes vote down vote up
public SymbolTreeDataFlavor( String displayText ) {
	super( DataFlavor.javaJVMLocalObjectMimeType +
               "; class=" + JAVA_CLASS_NAME, displayText );
}
 
Example 10
Source File: MainPanel.java    From java-swing-tips with MIT License 4 votes vote down vote up
@Override public DataFlavor[] getTransferDataFlavors() {
  return new DataFlavor[] {new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType, NAME)};
}
 
Example 11
Source File: ListDataFlavor.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
public ListDataFlavor() {
    super(DataFlavor.javaJVMLocalObjectMimeType + 
            ";class=java.util.List", "List");
}