本文整理汇总了Java中java.awt.dnd.DropTargetDropEvent类的典型用法代码示例。如果您正苦于以下问题:Java DropTargetDropEvent类的具体用法?Java DropTargetDropEvent怎么用?Java DropTargetDropEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DropTargetDropEvent类属于java.awt.dnd包,在下文中一共展示了DropTargetDropEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: end
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
void end(EventObject e, boolean clear) {
Point pt = (e instanceof MouseEvent) ? ((MouseEvent)e).getPoint() : ((DropTargetDropEvent)e).getLocation();
started = false;
currentItem = null;
if(dragComponent == null) return;
if ((e instanceof DropTargetDropEvent)
|| ((e instanceof MouseEvent) && !((MouseEvent) e).isShiftDown())) {// #195795: Do not deselect the dropTarget when Shift is pressed
menuEditLayer.layers.remove(dragComponent);
menuEditLayer.dropTargetLayer.clearDropTarget();
}
switch (op) {
case PICK_AND_PLOP_FROM_PALETTE: completePickAndPlopFromPalette(pt, clear); break;
case INTER_MENU_DRAG: completeInterMenuDrag(pt); break ;
case NO_MENUBAR: /* do nothing */ break;
}
menuEditLayer.glassLayer.requestFocusInWindow();
if ((e instanceof DropTargetDropEvent)
|| ((e instanceof MouseEvent) && !((MouseEvent) e).isShiftDown())) {// #195795: Do not deselect the dropTarget when Shift is pressed
payloadComponent = null;
targetComponent = null;
}
menuEditLayer.repaint();
}
示例2: drop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
@Override
public void drop(DropTargetDropEvent e) {
Collection<? extends ExternalDropHandler> handlers = Lookup.getDefault().lookupAll(ExternalDropHandler.class);
for (ExternalDropHandler handler : handlers) {
if (handler.canDrop(e)) {
e.acceptDrop(DnDConstants.ACTION_COPY);
boolean dropped = handler.handleDrop(e);
if(!dropped) {
continue; //try next ExternalDropHandler
}
e.dropComplete(true);
isDragging = false;
return;
}
}
orig.drop(e);
isDragging = false;
}
示例3: drop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
public void drop(DropTargetDropEvent dtde) {
boolean res = false;
try {
if( isButtonDrag ) {
if( validateDropPosition() ) {
res = handleDrop( dtde.getTransferable() );
}
} else if( isToolbarDrag ) {
res = true;
//taken care of in dragDropEnd()
}
} finally {
dtde.dropComplete(res);
}
resetDropGesture();
}
示例4: drop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
dtde.acceptDrop(DnDConstants.ACTION_COPY);
try {
Transferable t = dtde.getTransferable();
DataFlavor[] dataFlavors = t.getTransferDataFlavors();
for (DataFlavor df : dataFlavors) {
if (df.isFlavorJavaFileListType()) {
File[] filesArray = (File[]) ((List<File>) t.getTransferData(df)).toArray();
pathNameTextField.setText(getFilesName(filesArray));
}
}
} catch (UnsupportedFlavorException e2) {
} catch (IOException ex) {
Logger.getLogger(SubtitleDownloaderUI.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例5: drop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
public void drop(DropTargetDropEvent dtde) {
if (dtde.getDropTargetContext().getComponent() == theMap) {
final MouseEvent evt = new MouseEvent(
theMap,
MouseEvent.MOUSE_RELEASED,
System.currentTimeMillis(),
0,
dtde.getLocation().x,
dtde.getLocation().y,
1,
false
);
theMap.dispatchEvent(evt);
dtde.dropComplete(true);
}
if (scroller.isRunning()) scroller.stop();
}
示例6: handleDrop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
@Override
public boolean handleDrop(DropTargetDropEvent e) throws Exception
{
List<File> files = DnDUtils.getDroppedNativeFiles(e.getTransferable());
try
{
FileInfo dir = fileList.getFileUnderMouseCursor();
if( dir == null || !dir.isDirectory() )
{
dir = fileList.getCurrentDirectory();
}
uploadFiles(dir, files.toArray(new File[files.size()]));
return true;
}
catch( Exception ex )
{
ex.printStackTrace();
return false;
}
}
示例7: drop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
/**
*
* @param e
*/
public void drop(DropTargetDropEvent e)
{
if (canImport)
{
mxGraphTransferHandler handler = getGraphTransferHandler(e);
MouseEvent event = createEvent(e);
// Ignores the event in mouseReleased if it is
// handled by the transfer handler as a drop
if (handler != null && !handler.isLocalDrag())
{
event.consume();
}
mouseReleased(event);
}
}
示例8: drop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
public void drop(DropTargetDropEvent e)
{
if (dragSource != null)
{
e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
Point p = e.getLocation();
int targetRow = rowAtPoint(p);
Object edge = graph.insertEdge(null, null, null,
dragSource.cell, JTableRenderer.this.cell, "sourceRow="
+ sourceRow + ";targetRow=" + targetRow);
graph.setSelectionCell(edge);
// System.out.println("clearing drag source");
dragSource = null;
e.dropComplete(true);
}
else
{
e.rejectDrop();
}
}
示例9: drop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
public void drop(DropTargetDropEvent e) {
if (dragSource != null) {
e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
Point p = e.getLocation();
int targetRow = rowAtPoint(p);
Object edge = graph.insertEdge(null, null, null, dragSource.cell, JTableRenderer.this.cell,
"sourceRow=" + sourceRow + ";targetRow=" + targetRow);
graph.setSelectionCell(edge);
// System.out.println("clearing drag source");
dragSource = null;
e.dropComplete(true);
} else {
e.rejectDrop();
}
}
示例10: drop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
@Override
public void drop(DropTargetDropEvent dtde) {
if (checkDropValid()) {
int action = dtde.getDropAction();
ProjectHandler project = ProjectHandler.getInstance();
if (action == DnDConstants.ACTION_MOVE) {
project.removeNodeFromParent(incomingNode);
} else if (action == DnDConstants.ACTION_COPY) {
incomingNode = incomingNode.copy();
}
project.insertNodeInto(incomingNode, targetNode, 0);
expandPath(path);
selectionModel.setSelectionPath(path.pathByAddingChild(incomingNode));
dtde.acceptDrop(action);
} else {
dtde.rejectDrop();
}
finishDnD();
}
示例11: drop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
public void drop(DropTargetDropEvent e)
{
if (dragSource != null)
{
e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
Point p = e.getLocation();
int targetRow = rowAtPoint(p);
Object edge = graph.insertEdge(null, null, null,
dragSource.cell, JTableRenderer.this.cell, "sourceRow="
+ sourceRow + ";targetRow=" + targetRow, null);
graph.setSelectionCell(edge);
// System.out.println("clearing drag source");
dragSource = null;
e.dropComplete(true);
}
else
{
e.rejectDrop();
}
}
示例12: drop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
@Override
public synchronized void drop(DropTargetDropEvent event) {
event.acceptDrop(DnDConstants.ACTION_COPY);
try {
@SuppressWarnings("unchecked")
List<File> droppedFiles = (List<File>) event.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
int count = droppedFiles.size();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < droppedFiles.size(); i++) {
sb.append(droppedFiles.get(i));
if (i != count-1) {
sb.append("|");
}
}
target.setText(sb.toString());
} catch (UnsupportedFlavorException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例13: drop
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
public synchronized void drop(DropTargetDropEvent event) {
event.acceptDrop(DnDConstants.ACTION_COPY);
try {
@SuppressWarnings("unchecked")
List<File> droppedFiles = (List<File>) event.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
int count = droppedFiles.size();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < droppedFiles.size(); i++) {
sb.append(droppedFiles.get(i));
if (i != count-1) {
sb.append("|");
}
}
target.setText(sb.toString());
} catch (UnsupportedFlavorException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例14: initDnD
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
private void initDnD()
{
TreeDnDHandlerCallback treeDnDHandlerCallback = new TreeDnDHandlerCallback()
{
@Override
public boolean nodeAcceptsKids(DefaultMutableTreeNode selNode)
{
return onNodeAcceptsKids(selNode);
}
@Override
public void dndExecuted()
{
onDndExecuted();
}
@Override
public ArrayList<DefaultMutableTreeNode> createPasteTreeNodesFromExternalTransfer(DropTargetDropEvent dtde, TreePath targetPath)
{
return onCreatePasteTreeNodesFromExternalTransfer(dtde, targetPath);
}
};
new TreeDnDHandler(_dialog.treFiles, treeDnDHandlerCallback, true);
}
示例15: onCreatePasteTreeNodesFromExternalTransfer
import java.awt.dnd.DropTargetDropEvent; //导入依赖的package包/类
private ArrayList<DefaultMutableTreeNode> onCreatePasteTreeNodesFromExternalTransfer(DropTargetDropEvent dtde, TreePath targetPath)
{
List<File> files = DropedFileExtractor.getFiles(dtde, _app);
ArrayList<DefaultMutableTreeNode> ret = new ArrayList<DefaultMutableTreeNode>();
DefaultMutableTreeNode parent = findParent(targetPath);
for (File file : files)
{
if (false == parentContainsFile(parent, file))
{
ret.add(new DefaultMutableTreeNode(file));
}
}
return ret;
}