本文整理汇总了Java中java.awt.dnd.peer.DragSourceContextPeer.startDrag方法的典型用法代码示例。如果您正苦于以下问题:Java DragSourceContextPeer.startDrag方法的具体用法?Java DragSourceContextPeer.startDrag怎么用?Java DragSourceContextPeer.startDrag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.dnd.peer.DragSourceContextPeer
的用法示例。
在下文中一共展示了DragSourceContextPeer.startDrag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startDrag
import java.awt.dnd.peer.DragSourceContextPeer; //导入方法依赖的package包/类
public void startDrag(DragGestureEvent trigger, Cursor dragCursor,
Image dragImage, Point imageOffset,
Transferable transferable, DragSourceListener dsl,
FlavorMap flavorMap)
throws InvalidDnDOperationException {
if (curContext != null) {
// awt.171=Attempt to start a drag while an existing drag operation is still executing.
throw new InvalidDnDOperationException(Messages.getString("awt.171")); //$NON-NLS-1$
}
DragSourceContextPeer peer =
Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);
curContext = createDragSourceContext(peer, trigger, dragCursor,
dragImage, imageOffset,
transferable, dsl);
peer.startDrag(curContext, dragCursor, dragImage, imageOffset);
curContext = null;
}
示例2: startDrag
import java.awt.dnd.peer.DragSourceContextPeer; //导入方法依赖的package包/类
/**
* Start a drag, given the <code>DragGestureEvent</code>
* that initiated the drag, the initial
* <code>Cursor</code> to use,
* the <code>Image</code> to drag,
* the offset of the <code>Image</code> origin
* from the hotspot of the <code>Cursor</code> at
* the instant of the trigger,
* the <code>Transferable</code> subject data
* of the drag, the <code>DragSourceListener</code>,
* and the <code>FlavorMap</code>.
* <P>
* @param trigger the <code>DragGestureEvent</code> that initiated the drag
* @param dragCursor the initial {@code Cursor} for this drag operation
* or {@code null} for the default cursor handling;
* see <a href="DragSourceContext.html#defaultCursor">DragSourceContext</a>
* for more details on the cursor handling mechanism during drag and drop
* @param dragImage the image to drag or {@code null}
* @param imageOffset the offset of the <code>Image</code> origin from the hotspot
* of the <code>Cursor</code> at the instant of the trigger
* @param transferable the subject data of the drag
* @param dsl the <code>DragSourceListener</code>
* @param flavorMap the <code>FlavorMap</code> to use, or <code>null</code>
* <P>
* @throws java.awt.dnd.InvalidDnDOperationException
* if the Drag and Drop
* system is unable to initiate a drag operation, or if the user
* attempts to start a drag while an existing drag operation
* is still executing
*/
public void startDrag(DragGestureEvent trigger,
Cursor dragCursor,
Image dragImage,
Point imageOffset,
Transferable transferable,
DragSourceListener dsl,
FlavorMap flavorMap) throws InvalidDnDOperationException {
SunDragSourceContextPeer.setDragDropInProgress(true);
try {
if (flavorMap != null) this.flavorMap = flavorMap;
DragSourceContextPeer dscp = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);
DragSourceContext dsc = createDragSourceContext(dscp,
trigger,
dragCursor,
dragImage,
imageOffset,
transferable,
dsl
);
if (dsc == null) {
throw new InvalidDnDOperationException();
}
dscp.startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
} catch (RuntimeException e) {
SunDragSourceContextPeer.setDragDropInProgress(false);
throw e;
}
}
示例3: startDrag
import java.awt.dnd.peer.DragSourceContextPeer; //导入方法依赖的package包/类
/**
* Start a drag, given the <code>DragGestureEvent</code>
* that initiated the drag, the initial
* <code>Cursor</code> to use,
* the <code>Image</code> to drag,
* the offset of the <code>Image</code> origin
* from the hotspot of the <code>Cursor</code> at
* the instant of the trigger,
* the <code>Transferable</code> subject data
* of the drag, the <code>DragSourceListener</code>,
* and the <code>FlavorMap</code>.
* <P>
* @param trigger the <code>DragGestureEvent</code> that initiated the drag
* @param dragCursor the initial <code>Cursor</code> or <code>null</code> for defaults
* @param dragImage the image to drag or null,
* @param imageOffset the offset of the <code>Image</code> origin from the hotspot
* of the <code>Cursor</code> at the instant of the trigger
* @param transferable the subject data of the drag
* @param dsl the <code>DragSourceListener</code>
* @param flavorMap the <code>FlavorMap</code> to use, or <code>null</code>
* <P>
* @throws <code>java.awt.dnd.InvalidDnDOperationException</code>
* if the Drag and Drop
* system is unable to initiate a drag operation, or if the user
* attempts to start a drag while an existing drag operation
* is still executing
*/
public void startDrag(DragGestureEvent trigger,
Cursor dragCursor,
Image dragImage,
Point imageOffset,
Transferable transferable,
DragSourceListener dsl,
FlavorMap flavorMap) throws InvalidDnDOperationException {
SunDragSourceContextPeer.setDragDropInProgress(true);
try {
if (flavorMap != null) this.flavorMap = flavorMap;
DragSourceContextPeer dscp = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);
DragSourceContext dsc = createDragSourceContext(dscp,
trigger,
dragCursor,
dragImage,
imageOffset,
transferable,
dsl
);
if (dsc == null) {
throw new InvalidDnDOperationException();
}
dscp.startDrag(dsc, dsc.getCursor(), dragImage, imageOffset); // may throw
} catch (RuntimeException e) {
SunDragSourceContextPeer.setDragDropInProgress(false);
throw e;
}
}