public class DropTargetDropEvent extends DropTargetEvent
DropTargetDropEvent经由递送DropTargetListener降()方法。
DropTargetDropEvent报告源放弃操作和反映当前拖放操作状态的用户放置操作 。
源放置操作是DnDConstants的按位掩码,表示拖放源支持的拖放操作集合,用于此拖放操作。
用户放置操作取决于拖动源支持的放置操作和用户选择的放置操作。 用户可以在拖动操作期间按修改键来选择放置操作:
Ctrl + Shift -> ACTION_LINK
Ctrl -> ACTION_COPY
Shift -> ACTION_MOVE
如果用户选择放置操作,则用户放弃操作是DnDConstants中的一个,表示如果拖放源DnDConstants.ACTION_NONE该放置操作,则选择放置操作,如果拖放源不支持此放置操作,则为DnDConstants.ACTION_NONE。
如果用户没有选择降动作,一套DnDConstants表示设置拖动源支持的放置动作中搜索DnDConstants.ACTION_MOVE ,然后DnDConstants.ACTION_COPY ,然后为DnDConstants.ACTION_LINK和用户drop操作是找到的第一个常量。 如果没有找到常量,则用户放弃操作是DnDConstants.ACTION_NONE 。
contextsource| Constructor and Description |
|---|
DropTargetDropEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions)
构造一个
DropTargetDropEvent给出的
DropTargetContext进行此操作,拖动的位置
Cursor的热点的
Component的坐标,当前选择的用户放置动作,和当前的一组源支持的动作。
|
DropTargetDropEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions, boolean isLocal)
构造一个
DropTargetEvent给定
DropTargetContext的这个操作,拖动
Cursor的热点的位置在
Component的坐标,当前选择的用户放置动作,当前支持的一组动作源和一个
boolean指示源与目标相同的JVM。
|
| Modifier and Type | Method and Description |
|---|---|
void |
acceptDrop(int dropAction)
使用指定的操作接受下拉。
|
void |
dropComplete(boolean success)
该方法通知
DragSource丢弃传输已完成。
|
DataFlavor[] |
getCurrentDataFlavors()
此方法返回当前DataFlavors。
|
List<DataFlavor> |
getCurrentDataFlavorsAsList()
此方法返回当前可用的
DataFlavor s作为
java.util.List 。
|
int |
getDropAction()
此方法返回用户放置操作。
|
Point |
getLocation()
该方法返回一个
Point表示
Cursor “在当前位置
Component坐标”。
|
int |
getSourceActions()
此方法返回源放置操作。
|
Transferable |
getTransferable()
此方法返回与下拉
Transferable对象。
|
boolean |
isDataFlavorSupported(DataFlavor df)
此方法返回一个
boolean指示指定的
DataFlavor是否可从源中获取。
|
boolean |
isLocalTransfer()
此方法返回一个
int指示源是否与目标相同。
|
void |
rejectDrop()
拒绝掉落。
|
getDropTargetContextgetSource, toStringpublic DropTargetDropEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions)
DropTargetDropEvent给定DropTargetContext的这个操作,拖动Cursor的热点位置Component的坐标,当前选择的用户放置动作,以及源的当前支持的一组动作。
默认情况下,此构造函数假定目标与源不在同一个虚拟机中;
也就是isLocalTransfer()将返回false 。
dtc - 此
DropTargetContext的DropTargetContext
cursorLocn -的“拖放” Cursor的热点中的位置
Component坐标
dropAction - 用户删除操作。
srcActions - 源放弃操作。
NullPointerException - 如果cursorLocn是
null
IllegalArgumentException - 如果dropAction不是
DnDConstants 。
IllegalArgumentException -如果srcActions不是位掩码
DnDConstants 。
IllegalArgumentException - 如果dtc是
null 。
public DropTargetDropEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions, boolean isLocal)
DropTargetEvent给定
DropTargetContext为此操作,位置拖动
Cursor的热点在
Component的坐标,当前选择的用户放置动作,当前的动作支持的动作和一个
boolean指示源是否与目标相同的JVM。
dtc - 此操作的DropTargetContext
cursorLocn -
cursorLocn坐标中“拖动”光标的热点的位置
dropAction - 用户删除操作。
srcActions - 源放行动。
isLocal - 如果源与目标相同的JVM,则为真
NullPointerException - 如果cursorLocn是
null
IllegalArgumentException - 如果dropAction不是
DnDConstants 。
IllegalArgumentException -如果srcActions不是位掩码
DnDConstants 。
IllegalArgumentException - 如果dtc为
null 。
public Point getLocation()
Point表示
Cursor “在当前位置
Component坐标”。
Cursor位置在组件的协调。
public DataFlavor[] getCurrentDataFlavors()
public List<DataFlavor> getCurrentDataFlavorsAsList()
DataFlavor S作为
java.util.List 。
public boolean isDataFlavorSupported(DataFlavor df)
boolean指示指定的
DataFlavor是否可从源中获得。
df - 要测试的
DataFlavor
public int getSourceActions()
public int getDropAction()
public Transferable getTransferable()
Transferable对象。
Transferable与drop相关
public void acceptDrop(int dropAction)
dropAction - 指定的动作
public void rejectDrop()
public void dropComplete(boolean success)
DragSource丢弃传输已完成。
success
boolean boolean指示落下传送完成。
public boolean isLocalTransfer()
int指示源是否与目标相同。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.