本文整理汇总了Java中java.awt.Component.getDropTarget方法的典型用法代码示例。如果您正苦于以下问题:Java Component.getDropTarget方法的具体用法?Java Component.getDropTarget怎么用?Java Component.getDropTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Component
的用法示例。
在下文中一共展示了Component.getDropTarget方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processEnterMessage
import java.awt.Component; //导入方法依赖的package包/类
/**
* actual processing on EventQueue Thread
*/
protected void processEnterMessage(SunDropTargetEvent event) {
Component c = (Component)event.getSource();
DropTarget dt = c.getDropTarget();
Point hots = event.getPoint();
local = getJVMLocalSourceTransferable();
if (currentDTC != null) { // some wreckage from last time
currentDTC.removeNotify();
currentDTC = null;
}
if (c.isShowing() && dt != null && dt.isActive()) {
currentDT = dt;
currentDTC = currentDT.getDropTargetContext();
currentDTC.addNotify(this);
currentA = dt.getDefaultActions();
try {
((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
hots,
currentDA,
currentSA));
} catch (Exception e) {
e.printStackTrace();
currentDA = DnDConstants.ACTION_NONE;
}
} else {
currentDT = null;
currentDTC = null;
currentDA = DnDConstants.ACTION_NONE;
currentSA = DnDConstants.ACTION_NONE;
currentA = DnDConstants.ACTION_NONE;
}
}
示例2: processExitMessage
import java.awt.Component; //导入方法依赖的package包/类
/**
*
*/
protected void processExitMessage(SunDropTargetEvent event) {
Component c = (Component)event.getSource();
DropTarget dt = c.getDropTarget();
DropTargetContext dtc = null;
if (dt == null) {
currentDT = null;
currentT = null;
if (currentDTC != null) {
currentDTC.removeNotify();
}
currentDTC = null;
return;
}
if (dt != currentDT) {
if (currentDTC != null) {
currentDTC.removeNotify();
}
currentDT = dt;
currentDTC = dt.getDropTargetContext();
currentDTC.addNotify(this);
}
dtc = currentDTC;
if (dt.isActive()) try {
((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
} catch (Exception e) {
e.printStackTrace();
} finally {
currentA = DnDConstants.ACTION_NONE;
currentSA = DnDConstants.ACTION_NONE;
currentDA = DnDConstants.ACTION_NONE;
currentDT = null;
currentT = null;
currentDTC.removeNotify();
currentDTC = null;
local = null;
dragRejected = false;
}
}
示例3: processMotionMessage
import java.awt.Component; //导入方法依赖的package包/类
/**
*
*/
protected void processMotionMessage(SunDropTargetEvent event,
boolean operationChanged) {
Component c = (Component)event.getSource();
Point hots = event.getPoint();
int id = event.getID();
DropTarget dt = c.getDropTarget();
DropTargetContext dtc = null;
if (c.isShowing() && (dt != null) && dt.isActive()) {
if (currentDT != dt) {
if (currentDTC != null) {
currentDTC.removeNotify();
}
currentDT = dt;
currentDTC = null;
}
dtc = currentDT.getDropTargetContext();
if (dtc != currentDTC) {
if (currentDTC != null) {
currentDTC.removeNotify();
}
currentDTC = dtc;
currentDTC.addNotify(this);
}
currentA = currentDT.getDefaultActions();
try {
DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
hots,
currentDA,
currentSA);
DropTargetListener dtl = (DropTargetListener)dt;
if (operationChanged) {
dtl.dropActionChanged(dtde);
} else {
dtl.dragOver(dtde);
}
if (dragRejected) {
currentDA = DnDConstants.ACTION_NONE;
}
} catch (Exception e) {
e.printStackTrace();
currentDA = DnDConstants.ACTION_NONE;
}
} else {
currentDA = DnDConstants.ACTION_NONE;
}
}
示例4: processDropMessage
import java.awt.Component; //导入方法依赖的package包/类
/**
*
*/
protected void processDropMessage(SunDropTargetEvent event) {
Component c = (Component)event.getSource();
Point hots = event.getPoint();
DropTarget dt = c.getDropTarget();
dropStatus = STATUS_WAIT; // drop pending ACK
dropComplete = false;
if (c.isShowing() && dt != null && dt.isActive()) {
DropTargetContext dtc = dt.getDropTargetContext();
currentDT = dt;
if (currentDTC != null) {
currentDTC.removeNotify();
}
currentDTC = dtc;
currentDTC.addNotify(this);
currentA = dt.getDefaultActions();
synchronized(_globalLock) {
if ((local = getJVMLocalSourceTransferable()) != null)
setCurrentJVMLocalSourceTransferable(null);
}
dropInProcess = true;
try {
((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
hots,
currentDA,
currentSA,
local != null));
} finally {
if (dropStatus == STATUS_WAIT) {
rejectDrop();
} else if (dropComplete == false) {
dropComplete(false);
}
dropInProcess = false;
}
} else {
rejectDrop();
}
}
示例5: processEnterMessage
import java.awt.Component; //导入方法依赖的package包/类
/**
* actual processing on EventQueue Thread
*/
protected void processEnterMessage(SunDropTargetEvent event) {
Component c = (Component)event.getSource();
DropTarget dt = c.getDropTarget();
Point hots = event.getPoint();
local = getJVMLocalSourceTransferable();
DropTargetContextAccessor acc =
AWTAccessor.getDropTargetContextAccessor();
if (currentDTC != null) { // some wreckage from last time
acc.reset(currentDTC);
currentDTC = null;
}
if (c.isShowing() && dt != null && dt.isActive()) {
currentDT = dt;
currentDTC = currentDT.getDropTargetContext();
acc.setDropTargetContextPeer(currentDTC, this);
currentA = dt.getDefaultActions();
try {
((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
hots,
currentDA,
currentSA));
} catch (Exception e) {
e.printStackTrace();
currentDA = DnDConstants.ACTION_NONE;
}
} else {
currentDT = null;
currentDTC = null;
currentDA = DnDConstants.ACTION_NONE;
currentSA = DnDConstants.ACTION_NONE;
currentA = DnDConstants.ACTION_NONE;
}
}
示例6: processExitMessage
import java.awt.Component; //导入方法依赖的package包/类
/**
*
*/
protected void processExitMessage(SunDropTargetEvent event) {
Component c = (Component)event.getSource();
DropTarget dt = c.getDropTarget();
DropTargetContext dtc = null;
DropTargetContextAccessor acc =
AWTAccessor.getDropTargetContextAccessor();
if (dt == null) {
currentDT = null;
currentT = null;
if (currentDTC != null) {
acc.reset(currentDTC);
}
currentDTC = null;
return;
}
if (dt != currentDT) {
if (currentDTC != null) {
acc.reset(currentDTC);
}
currentDT = dt;
currentDTC = dt.getDropTargetContext();
acc.setDropTargetContextPeer(currentDTC, this);
}
dtc = currentDTC;
if (dt.isActive()) try {
((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
} catch (Exception e) {
e.printStackTrace();
} finally {
currentA = DnDConstants.ACTION_NONE;
currentSA = DnDConstants.ACTION_NONE;
currentDA = DnDConstants.ACTION_NONE;
currentDT = null;
currentT = null;
acc.reset(currentDTC);
currentDTC = null;
local = null;
dragRejected = false;
}
}
示例7: processMotionMessage
import java.awt.Component; //导入方法依赖的package包/类
/**
*
*/
protected void processMotionMessage(SunDropTargetEvent event,
boolean operationChanged) {
Component c = (Component)event.getSource();
Point hots = event.getPoint();
int id = event.getID();
DropTarget dt = c.getDropTarget();
DropTargetContext dtc = null;
DropTargetContextAccessor acc =
AWTAccessor.getDropTargetContextAccessor();
if (c.isShowing() && (dt != null) && dt.isActive()) {
if (currentDT != dt) {
if (currentDTC != null) {
acc.reset(currentDTC);
}
currentDT = dt;
currentDTC = null;
}
dtc = currentDT.getDropTargetContext();
if (dtc != currentDTC) {
if (currentDTC != null) {
acc.reset(currentDTC);
}
currentDTC = dtc;
acc.setDropTargetContextPeer(currentDTC, this);
}
currentA = currentDT.getDefaultActions();
try {
DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
hots,
currentDA,
currentSA);
DropTargetListener dtl = (DropTargetListener)dt;
if (operationChanged) {
dtl.dropActionChanged(dtde);
} else {
dtl.dragOver(dtde);
}
if (dragRejected) {
currentDA = DnDConstants.ACTION_NONE;
}
} catch (Exception e) {
e.printStackTrace();
currentDA = DnDConstants.ACTION_NONE;
}
} else {
currentDA = DnDConstants.ACTION_NONE;
}
}
示例8: processDropMessage
import java.awt.Component; //导入方法依赖的package包/类
/**
*
*/
protected void processDropMessage(SunDropTargetEvent event) {
Component c = (Component)event.getSource();
Point hots = event.getPoint();
DropTarget dt = c.getDropTarget();
dropStatus = STATUS_WAIT; // drop pending ACK
dropComplete = false;
if (c.isShowing() && dt != null && dt.isActive()) {
DropTargetContext dtc = dt.getDropTargetContext();
currentDT = dt;
DropTargetContextAccessor acc =
AWTAccessor.getDropTargetContextAccessor();
if (currentDTC != null) {
acc.reset(currentDTC);
}
currentDTC = dtc;
acc.setDropTargetContextPeer(currentDTC, this);
currentA = dt.getDefaultActions();
synchronized(_globalLock) {
if ((local = getJVMLocalSourceTransferable()) != null)
setCurrentJVMLocalSourceTransferable(null);
}
dropInProcess = true;
try {
((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
hots,
currentDA,
currentSA,
local != null));
} finally {
if (dropStatus == STATUS_WAIT) {
rejectDrop();
} else if (dropComplete == false) {
dropComplete(false);
}
dropInProcess = false;
}
} else {
rejectDrop();
}
}