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


Java DragSourceContextPeer类代码示例

本文整理汇总了Java中java.awt.dnd.peer.DragSourceContextPeer的典型用法代码示例。如果您正苦于以下问题:Java DragSourceContextPeer类的具体用法?Java DragSourceContextPeer怎么用?Java DragSourceContextPeer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DragSourceContextPeer类属于java.awt.dnd.peer包,在下文中一共展示了DragSourceContextPeer类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createDragSourceContextPeer

import java.awt.dnd.peer.DragSourceContextPeer; //导入依赖的package包/类
@Override
public DragSourceContextPeer createDragSourceContextPeer(
        DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return CDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:LWCToolkit.java

示例4: createDragSourceContextPeer

import java.awt.dnd.peer.DragSourceContextPeer; //导入依赖的package包/类
/**
 * create the peer for a DragSourceContext
 */

@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return WDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:WToolkit.java

示例5: createDragSourceContextPeer

import java.awt.dnd.peer.DragSourceContextPeer; //导入依赖的package包/类
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:XToolkit.java

示例6: createDragSourceContextPeer

import java.awt.dnd.peer.DragSourceContextPeer; //导入依赖的package包/类
@Override
public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
    final LightweightFrame f = SunToolkit.getLightweightFrame(dge.getComponent());
    if (f != null) {
        return f.createDragSourceContextPeer(dge);
    }

    return XDragSourceContextPeer.createDragSourceContextPeer(dge);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:XToolkit.java

示例7: DragSourceContext

import java.awt.dnd.peer.DragSourceContextPeer; //导入依赖的package包/类
/**
 * Initializes a drag source context.
 *
 * @exception IllegalArgumentException If Component or DragSource of trigger
 * are null, the drag action for the trigger event is DnDConstants.ACTION_NONE
 * or if the source actions for the DragGestureRecognizer associated with the
 * trigger event are equal to DnDConstants.ACTION_NONE.
 * @exception NullPointerException If peer, trans or trigger is null or if the
 * image is not null but the offset is.
 */
public DragSourceContext (DragSourceContextPeer peer,
                          DragGestureEvent trigger, Cursor cursor,
                          Image image, Point offset, Transferable trans,
                          DragSourceListener dsl)
{
  if (peer == null
      || trigger == null || trans == null
      || (image != null && offset == null))
    throw new NullPointerException ();

  if (trigger.getComponent () == null
      || trigger.getDragSource () == null
      || trigger.getDragAction () == DnDConstants.ACTION_NONE
      || trigger.getSourceAsDragGestureRecognizer ()
            .getSourceActions () == DnDConstants.ACTION_NONE)
    throw new IllegalArgumentException ();

  this.peer = peer;
  this.trigger = trigger;
  this.cursor = cursor;
  this.image = image;
  this.offset = offset;
  this.transferable = trans;
  this.dragSourceListener = dsl;
  this.sourceActions = trigger.getSourceAsDragGestureRecognizer().getSourceActions();

  setCursor(cursor);
  updateCurrentCursor(trigger.getDragAction(), sourceActions, DEFAULT);
}
 
开发者ID:vilie,项目名称:javify,代码行数:40,代码来源:DragSourceContext.java

示例8: createDragSourceContext

import java.awt.dnd.peer.DragSourceContextPeer; //导入依赖的package包/类
/**
 * Creates the DragSourceContext to handle this drag.
 *
 * @exception IllegalArgumentException
 * @exception NullPointerException If dscp, dgl, dragImage or t is null.
 */
protected DragSourceContext
  createDragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge,
                          Cursor cursor, Image image, Point offset,
                          Transferable t, DragSourceListener dsl)
{
  return new DragSourceContext(peer, dge, cursor, image, offset, t, dsl);
}
 
开发者ID:vilie,项目名称:javify,代码行数:14,代码来源:DragSource.java

示例9: DragSourceContext

import java.awt.dnd.peer.DragSourceContextPeer; //导入依赖的package包/类
/**
 * Initializes a drag source context.
 *
 * @exception IllegalArgumentException If Component or DragSource of trigger
 * are null, the drag action for the trigger event is DnDConstants.ACTION_NONE
 * or if the source actions for the DragGestureRecognizer associated with the
 * trigger event are equal to DnDConstants.ACTION_NONE.
 * @exception NullPointerException If peer, trans or trigger is null or if the
 * image is not null but the offset is. 
 */
public DragSourceContext (DragSourceContextPeer peer,
                          DragGestureEvent trigger, Cursor cursor,
                          Image image, Point offset, Transferable trans,
                          DragSourceListener dsl)
{    
  if (peer == null
      || trigger == null || trans == null
      || (image != null && offset == null))
    throw new NullPointerException ();

  if (trigger.getComponent () == null
      || trigger.getDragSource () == null
      || trigger.getDragAction () == DnDConstants.ACTION_NONE
      || trigger.getSourceAsDragGestureRecognizer ()
            .getSourceActions () == DnDConstants.ACTION_NONE)
    throw new IllegalArgumentException ();

  this.peer = peer;
  this.trigger = trigger;
  this.cursor = cursor;
  this.image = image;
  this.offset = offset;
  this.transferable = trans;
  this.dragSourceListener = dsl;
  this.sourceActions = trigger.getSourceAsDragGestureRecognizer().getSourceActions();
  
  setCursor(cursor);
  updateCurrentCursor(trigger.getDragAction(), sourceActions, DEFAULT);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:40,代码来源:DragSourceContext.java

示例10: createDragSourceContext

import java.awt.dnd.peer.DragSourceContextPeer; //导入依赖的package包/类
/**
 * Creates the DragSourceContext to handle this drag.
 *
 * @exception IllegalArgumentException 
 * @exception NullPointerException If dscp, dgl, dragImage or t is null.
 */
protected DragSourceContext
  createDragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge,
                          Cursor cursor, Image image, Point offset,
                          Transferable t, DragSourceListener dsl)
{
  return new DragSourceContext(peer, dge, cursor, image, offset, t, dsl);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:14,代码来源:DragSource.java

示例11: 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类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。