本文整理匯總了Java中java.awt.dnd.DropTarget.getDropTargetContext方法的典型用法代碼示例。如果您正苦於以下問題:Java DropTarget.getDropTargetContext方法的具體用法?Java DropTarget.getDropTargetContext怎麽用?Java DropTarget.getDropTargetContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.dnd.DropTarget
的用法示例。
在下文中一共展示了DropTarget.getDropTargetContext方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: processExitMessage
import java.awt.dnd.DropTarget; //導入方法依賴的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;
}
}
示例2: processDropMessage
import java.awt.dnd.DropTarget; //導入方法依賴的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();
}
}
示例3: processExitMessage
import java.awt.dnd.DropTarget; //導入方法依賴的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;
}
}
示例4: processDropMessage
import java.awt.dnd.DropTarget; //導入方法依賴的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();
}
}