transferable.getTransferData(LocalObjectTransferable.FLAVOR);
Object obj = LocalObjectTransfer.getTransfer().getObject();
handleDrop(dtde, obj);
-
- dtde.getDropTargetContext().dropComplete( true );
}
else {
DataFlavor textFlavor = DataFlavor.selectBestTextFlavor(transferable.getTransferDataFlavors());
if(textFlavor != null) {
+ // Try to read the textual content of the drop event as a JSON object containing a field named resourceId
try(Reader reader = textFlavor.getReaderForText(transferable)) {
ObjectMapper mapper = new ObjectMapper();
JsonNode node = mapper.readTree(reader);
}
}));
handleDrop(dtde, obj);
-
- dtde.getDropTargetContext().dropComplete( true );
return;
}
}
double x = canvasPosX+dtde.getLocation().getX()/canvasZoom;
double y = canvasPosY+dtde.getLocation().getY()/canvasZoom;
handleDrop(x, y, obj);
+
+ dtde.getDropTargetContext().dropComplete( true );
}
public void keyPressed(KeyEvent e) {