本文整理匯總了Java中java.awt.dnd.DragSourceEvent類的典型用法代碼示例。如果您正苦於以下問題:Java DragSourceEvent類的具體用法?Java DragSourceEvent怎麽用?Java DragSourceEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DragSourceEvent類屬於java.awt.dnd包,在下文中一共展示了DragSourceEvent類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dragDropFinished
import java.awt.dnd.DragSourceEvent; //導入依賴的package包/類
/**
* upcall from native code via implemented class (do)
*/
protected final void dragDropFinished(final boolean success,
final int operations,
final int x, final int y) {
DragSourceEvent event =
new DragSourceDropEvent(getDragSourceContext(),
operations & sourceActions,
success, x, y);
EventDispatcher dispatcher =
new EventDispatcher(DISPATCH_FINISH, event);
SunToolkit.invokeLaterOnAppContext(
SunToolkit.targetToAppContext(getComponent()), dispatcher);
startSecondaryEventLoop();
setNativeContext(0);
dragImage = null;
dragImageOffset = null;
}
示例2: EventDispatcher
import java.awt.dnd.DragSourceEvent; //導入依賴的package包/類
EventDispatcher(int dispatchType, DragSourceEvent event) {
switch (dispatchType) {
case DISPATCH_ENTER:
case DISPATCH_MOTION:
case DISPATCH_CHANGED:
case DISPATCH_MOUSE_MOVED:
if (!(event instanceof DragSourceDragEvent)) {
throw new IllegalArgumentException("Event: " + event);
}
break;
case DISPATCH_EXIT:
break;
case DISPATCH_FINISH:
if (!(event instanceof DragSourceDropEvent)) {
throw new IllegalArgumentException("Event: " + event);
}
break;
default:
throw new IllegalArgumentException("Dispatch type: " +
dispatchType);
}
this.dispatchType = dispatchType;
this.event = event;
}
示例3: run
import java.awt.dnd.DragSourceEvent; //導入依賴的package包/類
public void run() {
switch (type) {
case DRAG_ENTER:
context.dragEnter(newDragSourceDragEvent());
break;
case DRAG_OVER:
context.dragOver(newDragSourceDragEvent());
break;
case DRAG_ACTION_CHANGED:
context.dropActionChanged(newDragSourceDragEvent());
break;
case DRAG_MOUSE_MOVED:
context.dragMouseMoved(newDragSourceDragEvent());
break;
case DRAG_EXIT:
context.dragExit(new DragSourceEvent(context, x, y));
break;
case DRAG_DROP_END:
context.dragExit(new DragSourceDropEvent(
context, userAction, success, x, y));
break;
}
}
示例4: dragExit
import java.awt.dnd.DragSourceEvent; //導入依賴的package包/類
/**
* upcall from native code
*/
protected final void dragExit(final int x, final int y) {
DragSourceEvent event =
new DragSourceEvent(getDragSourceContext(), x, y);
EventDispatcher dispatcher =
new EventDispatcher(DISPATCH_EXIT, event);
SunToolkit.invokeLaterOnAppContext(
SunToolkit.targetToAppContext(getComponent()), dispatcher);
startSecondaryEventLoop();
}