当前位置: 首页>>代码示例>>Java>>正文


Java DragSourceContextPeer.startDrag方法代码示例

本文整理汇总了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;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:21,代码来源:DragSource.java

示例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;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:66,代码来源:DragSource.java

示例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;
    }
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:63,代码来源:DragSource.java


注:本文中的java.awt.dnd.peer.DragSourceContextPeer.startDrag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。