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


Java DnDConstants.ACTION_MOVE属性代码示例

本文整理汇总了Java中java.awt.dnd.DnDConstants.ACTION_MOVE属性的典型用法代码示例。如果您正苦于以下问题:Java DnDConstants.ACTION_MOVE属性的具体用法?Java DnDConstants.ACTION_MOVE怎么用?Java DnDConstants.ACTION_MOVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.dnd.DnDConstants的用法示例。


在下文中一共展示了DnDConstants.ACTION_MOVE属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkNodeForAction

/** Utility method.
* @return true if given node supports given action,
* false otherwise.
*/
static boolean checkNodeForAction(Node node, int dragAction) {
    if (
        node.canCut() &&
            ((dragAction == DnDConstants.ACTION_MOVE) || (dragAction == DnDConstants.ACTION_COPY_OR_MOVE))
    ) {
        return true;
    }

    if (
        node.canCopy() &&
            ((dragAction == DnDConstants.ACTION_COPY) || (dragAction == DnDConstants.ACTION_COPY_OR_MOVE) ||
            (dragAction == DnDConstants.ACTION_LINK) || (dragAction == DnDConstants.ACTION_REFERENCE))
    ) {
        return true;
    }

    // hmmm, conditions not satisfied..
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:DragDropUtilities.java

示例2: getXDnDActionForJavaAction

static long getXDnDActionForJavaAction(int javaAction) {
    switch (javaAction) {
    case DnDConstants.ACTION_COPY : return XA_XdndActionCopy.getAtom();
    case DnDConstants.ACTION_MOVE : return XA_XdndActionMove.getAtom();
    case DnDConstants.ACTION_LINK : return XA_XdndActionLink.getAtom();
    default                       : return 0;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:XDnDConstants.java

示例3: convertModifiersToDropAction

public static int convertModifiersToDropAction(final int modifiers,
                                               final int supportedActions) {
    int dropAction = DnDConstants.ACTION_NONE;

    /*
     * Fix for 4285634.
     * Calculate the drop action to match Motif DnD behavior.
     * If the user selects an operation (by pressing a modifier key),
     * return the selected operation or ACTION_NONE if the selected
     * operation is not supported by the drag source.
     * If the user doesn't select an operation search the set of operations
     * supported by the drag source for ACTION_MOVE, then for
     * ACTION_COPY, then for ACTION_LINK and return the first operation
     * found.
     */
    switch (modifiers & (InputEvent.SHIFT_DOWN_MASK |
                         InputEvent.CTRL_DOWN_MASK)) {
    case InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_LINK; break;
    case InputEvent.CTRL_DOWN_MASK:
        dropAction = DnDConstants.ACTION_COPY; break;
    case InputEvent.SHIFT_DOWN_MASK:
        dropAction = DnDConstants.ACTION_MOVE; break;
    default:
        if ((supportedActions & DnDConstants.ACTION_MOVE) != 0) {
            dropAction = DnDConstants.ACTION_MOVE;
        } else if ((supportedActions & DnDConstants.ACTION_COPY) != 0) {
            dropAction = DnDConstants.ACTION_COPY;
        } else if ((supportedActions & DnDConstants.ACTION_LINK) != 0) {
            dropAction = DnDConstants.ACTION_LINK;
        }
    }

    return dropAction & supportedActions;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:35,代码来源:SunDragSourceContextPeer.java

示例4: getJavaActionsForMotifActions

public static int getJavaActionsForMotifActions(int motifActions) {
    int javaActions = DnDConstants.ACTION_NONE;

    if ((motifActions & MOTIF_DND_MOVE) != 0) {
        javaActions |= DnDConstants.ACTION_MOVE;
    }
    if ((motifActions & MOTIF_DND_COPY) != 0) {
        javaActions |= DnDConstants.ACTION_COPY;
    }
    if ((motifActions & MOTIF_DND_LINK) != 0) {
        javaActions |= DnDConstants.ACTION_LINK;
    }

    return javaActions;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:MotifDnDConstants.java

示例5: DragManager

/** Creates a new instance of SplashDnDSupport */
DragManager(JComponent component) {
    this.component = component;
    dSource =  new DragSource();
    dRecognizer = dSource.createDefaultDragGestureRecognizer(this.component,DnDConstants.ACTION_MOVE,this);
    dTarget = new DropTarget(this.component,DnDConstants.ACTION_MOVE,this);
    component.addMouseMotionListener(this);
    oCursor = component.getCursor();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DragManager.java

示例6: getNodeTransferable

/** Gets right transferable of given nodes (according to given
* drag action) and also converts the transferable.<br>
* Can be called only with correct action constant.
* @return The transferable.
*/
static Transferable getNodeTransferable(Node[] nodes, int dragAction)
throws IOException {
    Transferable[] tArray = new Transferable[nodes.length];

    for (int i = 0; i < nodes.length; i++) {
        if ((dragAction & DnDConstants.ACTION_MOVE) != 0) {
            tArray[i] = nodes[i].clipboardCut();
        } else {
            tArray[i] = nodes[i].drag ();
        }
    }
    Transferable result;
    if (tArray.length == 1) {
        // only one node, so return regular single transferable
        result = tArray[0];
    } else {
        // enclose the transferables into multi transferable
        result = ExternalDragAndDrop.maybeAddExternalFileDnd( new Multi(tArray) );
    }

    Clipboard c = getClipboard();
    if (c instanceof ExClipboard) {
        return ((ExClipboard) c).convert(result);
    } else {
        return result;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:DragDropUtilities.java

示例7: dragMouseMoved

public void dragMouseMoved(DragSourceDragEvent e) {
    DragSourceContext context = e.getDragSourceContext();
    if( isButtonDrag ) {
        int action = e.getDropAction();
        if ((action & DnDConstants.ACTION_MOVE) != 0) {
            context.setCursor( dragMoveCursor );
        } else {
            if( isInToolbarPanel( e.getLocation() ) ) {
                context.setCursor( dragNoDropCursor );
            } else {
                context.setCursor( dragRemoveCursor );
            }
        }
    } else if( isToolbarDrag && null != dragWindow ) {
        Point p = new Point( e.getLocation() );
        p.x -= startingPoint.x;
        p.y -= startingPoint.y;
        dragWindow.setLocation(p);
        context.setCursor( Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR) );

        ToolbarRow row = config.getToolbarRowAt( e.getLocation() );
        if( null == row && (sourceRow.countVisibleToolbars() > 1 || !config.isLastRow(sourceRow)) ) {
            row = config.maybeAddEmptyRow( e.getLocation() );
        }

        ToolbarRow oldRow = currentRow;
        currentRow = row;
        if( null != oldRow && oldRow != currentRow ) {
            oldRow.hideDropFeedback();
            config.repaint();
        }
        if( null != currentRow )
            currentRow.showDropFeedback( sourceContainer, e.getLocation(), dragImage );
        if( !config.isLastRow(currentRow) )
            config.maybeRemoveLastRow();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:DnDSupport.java

示例8: getJavaActionForXDnDAction

static int getJavaActionForXDnDAction(long xdndAction) {
    if (xdndAction == XA_XdndActionCopy.getAtom()) {
        return DnDConstants.ACTION_COPY;
    } else if (xdndAction == XA_XdndActionMove.getAtom()) {
        return DnDConstants.ACTION_MOVE;
    } else if (xdndAction == XA_XdndActionLink.getAtom()) {
        return DnDConstants.ACTION_LINK;
    } else {
        return DnDConstants.ACTION_NONE;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:XDnDConstants.java

示例9: dragEnter

@Override
public final void dragEnter(DragSourceDragEvent dsde) {
	int action = dsde.getDropAction();
	if (action == DnDConstants.ACTION_COPY) {
		dsde.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
	} else {
		if (action == DnDConstants.ACTION_MOVE) {
			dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
		} else {
			dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:13,代码来源:JTreeUtil.java

示例10: dragOver

@Override
public final void dragOver(DragSourceDragEvent dsde) {
	int action = dsde.getDropAction();
	if (action == DnDConstants.ACTION_COPY) {
		dsde.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
	} else {
		if (action == DnDConstants.ACTION_MOVE) {
			dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveDrop);
		} else {
			dsde.getDragSourceContext().setCursor(DragSource.DefaultMoveNoDrop);
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:13,代码来源:JTreeUtil.java

示例11: View

public View(Board b, SetupStack s) {
  myBoard = b;
  myGrid = b.getGrid();
  myStack = s;
  slot = myStack.getTopPiece();
  if (slot != null) {
    myPiece = slot.getPiece();
  }
  new DropTarget(this, DnDConstants.ACTION_MOVE, this);
  ds.createDefaultDragGestureRecognizer(this,
    DnDConstants.ACTION_MOVE, this);
  setFocusTraversalKeysEnabled(false);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:13,代码来源:SetupStack.java

示例12: getMotifActionsForJavaActions

public static int getMotifActionsForJavaActions(int javaActions) {
    int motifActions = MOTIF_DND_NOOP;

    if ((javaActions & DnDConstants.ACTION_MOVE) != 0) {
        motifActions |= MOTIF_DND_MOVE;
    }
    if ((javaActions & DnDConstants.ACTION_COPY) != 0) {
        motifActions |= MOTIF_DND_COPY;
    }
    if ((javaActions & DnDConstants.ACTION_LINK) != 0) {
        motifActions |= MOTIF_DND_LINK;
    }

    return motifActions;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:MotifDnDConstants.java

示例13: checkConditions

/** @return True if conditions to continue with DnD
* operation were satisfied */
boolean checkConditions(DropTargetDragEvent dtde) {
    int index = comp.locationToIndex(dtde.getLocation());

    return (DnDConstants.ACTION_MOVE == dtde.getDropAction()) && (index >= 0);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:IndexedCustomizer.java


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