本文整理汇总了Java中sun.awt.dnd.SunDropTargetEvent类的典型用法代码示例。如果您正苦于以下问题:Java SunDropTargetEvent类的具体用法?Java SunDropTargetEvent怎么用?Java SunDropTargetEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SunDropTargetEvent类属于sun.awt.dnd包,在下文中一共展示了SunDropTargetEvent类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: trackMouseEnterExit
import sun.awt.dnd.SunDropTargetEvent; //导入依赖的package包/类
private void trackMouseEnterExit(Component targetOver, MouseEvent e) {
if (e instanceof SunDropTargetEvent) {
trackDropTargetEnterExit(targetOver, e);
return;
}
int id = e.getID();
if ( id != MouseEvent.MOUSE_EXITED &&
id != MouseEvent.MOUSE_DRAGGED &&
id != LWD_MOUSE_DRAGGED_OVER &&
!isMouseInNativeContainer) {
// any event but an exit or drag means we're in the native container
isMouseInNativeContainer = true;
startListeningForOtherDrags();
} else if (id == MouseEvent.MOUSE_EXITED) {
isMouseInNativeContainer = false;
stopListeningForOtherDrags();
}
targetLastEntered = retargetMouseEnterExit(targetOver, e,
targetLastEntered,
isMouseInNativeContainer);
}
示例2: eventToCacheIndex
import sun.awt.dnd.SunDropTargetEvent; //导入依赖的package包/类
private static int eventToCacheIndex(AWTEvent e) {
switch(e.getID()) {
case PaintEvent.PAINT:
return PAINT;
case PaintEvent.UPDATE:
return UPDATE;
case MouseEvent.MOUSE_MOVED:
return MOVE;
case MouseEvent.MOUSE_DRAGGED:
// Return -1 for SunDropTargetEvent since they are usually synchronous
// and we don't want to skip them by coalescing with MouseEvent or other drag events
return e instanceof SunDropTargetEvent ? -1 : DRAG;
default:
return e instanceof PeerEvent ? PEER : -1;
}
}
示例3: processMotionMessage
import sun.awt.dnd.SunDropTargetEvent; //导入依赖的package包/类
@Override
protected void processMotionMessage(SunDropTargetEvent event, boolean operationChanged) {
boolean eventInsideTarget = isEventInsideTarget(event);
if (event.getComponent().getDropTarget() == insideTarget) {
if (!eventInsideTarget) {
processExitMessage(event);
return;
}
} else {
if (eventInsideTarget) {
processEnterMessage(event);
} else {
return;
}
}
super.processMotionMessage(event, operationChanged);
}
示例4: eventPosted
import sun.awt.dnd.SunDropTargetEvent; //导入依赖的package包/类
@Override
protected void eventPosted(final SunDropTargetEvent e) {
if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
Runnable runnable = new Runnable() {
@Override
public void run() {
e.getDispatcher().unregisterAllEvents();
}
};
// NOTE: this PeerEvent must be a NORM_PRIORITY event to be
// dispatched after this SunDropTargetEvent, but before the next
// one, so we should pass zero flags.
PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0);
SunToolkit.executeOnEventHandlerThread(peerEvent);
}
}
示例5: eventProcessed
import sun.awt.dnd.SunDropTargetEvent; //导入依赖的package包/类
protected void eventProcessed(SunDropTargetEvent e, int returnValue,
boolean dispatcherDone) {
/* The native context is the pointer to the XClientMessageEvent
structure. */
long ctxt = getNativeDragContext();
/* If the event was not consumed, send a response to the source. */
try {
if (ctxt != 0 && !e.isConsumed()) {
Iterator dropTargetProtocols =
XDragAndDropProtocols.getDropTargetProtocols();
while (dropTargetProtocols.hasNext()) {
XDropTargetProtocol dropTargetProtocol =
(XDropTargetProtocol)dropTargetProtocols.next();
if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
returnValue)) {
break;
}
}
}
} finally {
if (dispatcherDone && ctxt != 0) {
unsafe.freeMemory(ctxt);
}
}
}
示例6: trackMouseEnterExit
import sun.awt.dnd.SunDropTargetEvent; //导入依赖的package包/类
private void trackMouseEnterExit(Component targetOver, MouseEvent e) {
if (e instanceof SunDropTargetEvent) {
trackDropTargetEnterExit(targetOver, e);
return;
}
int id = e.getID();
if ( id != MouseEvent.MOUSE_EXITED &&
id != MouseEvent.MOUSE_DRAGGED &&
id != LWD_MOUSE_DRAGGED_OVER &&
!isMouseInNativeContainer) {
// any event but an exit or drag means we're in the native container
isMouseInNativeContainer = true;
startListeningForOtherDrags();
} else if (id == MouseEvent.MOUSE_EXITED) {
isMouseInNativeContainer = false;
stopListeningForOtherDrags();
}
Component tle = retargetMouseEnterExit(targetOver, e,
targetLastEntered.get(),
isMouseInNativeContainer);
targetLastEntered = new WeakReference<>(tle);
}
示例7: eventProcessed
import sun.awt.dnd.SunDropTargetEvent; //导入依赖的package包/类
protected void eventProcessed(SunDropTargetEvent e, int returnValue,
boolean dispatcherDone) {
/* The native context is the pointer to the XClientMessageEvent
structure. */
long ctxt = getNativeDragContext();
/* If the event was not consumed, send a response to the source. */
try {
if (ctxt != 0 && !e.isConsumed()) {
Iterator<XDropTargetProtocol> dropTargetProtocols =
XDragAndDropProtocols.getDropTargetProtocols();
while (dropTargetProtocols.hasNext()) {
XDropTargetProtocol dropTargetProtocol =
dropTargetProtocols.next();
if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
returnValue)) {
break;
}
}
}
} finally {
if (dispatcherDone && ctxt != 0) {
unsafe.freeMemory(ctxt);
}
}
}
示例8: coalesceMouseEvent
import sun.awt.dnd.SunDropTargetEvent; //导入依赖的package包/类
private boolean coalesceMouseEvent(MouseEvent e) {
if (e instanceof SunDropTargetEvent) {
// SunDropTargetEvent should not coalesce with MouseEvent
return false;
}
EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
if (cache == null) {
return false;
}
int index = eventToCacheIndex(e);
if (index != -1 && cache[index] != null) {
cache[index].event = e;
return true;
}
return false;
}