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


Java DragSourceDragEvent类代码示例

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


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

示例1: postDragSourceDragEvent

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:SunDragSourceContextPeer.java

示例2: EventDispatcher

import java.awt.dnd.DragSourceDragEvent; //导入依赖的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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:SunDragSourceContextPeer.java

示例3: dragOver

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
@Override
public void dragOver(DragSourceDragEvent dsde) {
    DragSourceContext context = dsde.getDragSourceContext();
    
    if (!checkDropValid()) {
        context.setCursor(DragSource.DefaultMoveNoDrop);
        return;
    }
    
    switch (dsde.getDropAction()) {
        case DnDConstants.ACTION_MOVE:
            context.setCursor(DragSource.DefaultMoveDrop);
            break;
        case DnDConstants.ACTION_COPY:
            context.setCursor(DragSource.DefaultCopyDrop);
            break;
        default:
            context.setCursor(DragSource.DefaultMoveNoDrop);
            break;
    }
}
 
开发者ID:m-lima,项目名称:KATscans,代码行数:22,代码来源:DraggableTree.java

示例4: dragMouseMoved

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
@Override
public void dragMouseMoved(DragSourceDragEvent dsde) {
    if (dragInfo != null) {
        JhromeTabbedPaneUI draggedParent = SwingUtils.getJTabbedPaneAncestorUI(dragInfo.tab);
        if (draggedParent != null) {
            Point p = dsde.getLocation();
            SwingUtilities.convertPointFromScreen(p, draggedParent.tabbedPane);
            if (!Utils.contains(draggedParent.dropZone, p)) {
                dragOut(dsde.getDragSourceContext().getComponent(), dragInfo);
            }
        }

        if (dragInfo.floatingTabHandler != null) {
            dragInfo.floatingTabHandler.onFloatingTabDragged(dsde, dragInfo.tab, dragInfo.grabX);
        }
    }
}
 
开发者ID:DJVUpp,项目名称:Desktop,代码行数:18,代码来源:JhromeTabbedPaneUI.java

示例5: dragMouseMoved

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
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,代码行数:38,代码来源:DnDSupport.java

示例6: dragMouseMoved

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
public void dragMouseMoved(DragSourceDragEvent event) {
  if (!event.getLocation().equals(lastDragLocation)) {
    lastDragLocation = event.getLocation();
    moveDragCursor(event.getX(), event.getY());
    if (dragCursor != null && !dragCursor.isVisible()) {
      dragCursor.setVisible(true);
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:10,代码来源:SetupStack.java

示例7: dragMouseMoved

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
public void dragMouseMoved(DragSourceDragEvent e) {
  if (!e.getLocation().equals(lastDragLocation)) {
    lastDragLocation = e.getLocation();
    moveDragCursor(e.getX(), e.getY());
    if (dragCursor != null && !dragCursor.isVisible()) {
      dragCursor.setVisible(true);
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:10,代码来源:PieceMover.java

示例8: run

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
public void run() {
    DragSourceContext dragSourceContext =
        SunDragSourceContextPeer.this.getDragSourceContext();
    try {
        switch (dispatchType) {
        case DISPATCH_ENTER:
            dragSourceContext.dragEnter((DragSourceDragEvent)event);
            break;
        case DISPATCH_MOTION:
            dragSourceContext.dragOver((DragSourceDragEvent)event);
            break;
        case DISPATCH_CHANGED:
            dragSourceContext.dropActionChanged((DragSourceDragEvent)event);
            break;
        case DISPATCH_EXIT:
            dragSourceContext.dragExit(event);
            break;
        case DISPATCH_MOUSE_MOVED:
            dragSourceContext.dragMouseMoved((DragSourceDragEvent)event);
            break;
        case DISPATCH_FINISH:
            try {
                dragSourceContext.dragDropEnd((DragSourceDropEvent)event);
            } finally {
                SunDragSourceContextPeer.this.cleanup();
            }
            break;
        default:
            throw new IllegalStateException("Dispatch type: " +
                                            dispatchType);
        }
    } finally {
         SunDragSourceContextPeer.this.quitSecondaryEventLoop();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:SunDragSourceContextPeer.java

示例9: dragEnter

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
@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,代码行数:14,代码来源:JTreeUtil.java

示例10: dragOver

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
@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,代码行数:14,代码来源:JTreeUtil.java

示例11: dropActionChanged

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
@Override
public final void dropActionChanged(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,代码行数:14,代码来源:JTreeUtil.java

示例12: dragOver

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
public void dragOver(DragSourceDragEvent event)
{
    if (ComponentRegistry.getContent().getActiveCanvas()._allowDrop)
        event.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
    else
        event.getDragSourceContext().setCursor(DragSource.DefaultCopyNoDrop);
}
 
开发者ID:StottlerHenkeAssociates,项目名称:SimBionic,代码行数:8,代码来源:SB_LocalsTree.java

示例13: dragOver

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
public void dragOver(DragSourceDragEvent event)
{
    Point location = event.getLocation();
    Point screenLocation = getLocationOnScreen();
    TreePath treePath = getPathForLocation(location.x - screenLocation.x, location.y
            - screenLocation.y);
    if (treePath != null
            && ((_dragNode.getUserObject() instanceof SB_Function) || (_dragNode
                    .getUserObject() instanceof SB_Folder)))
    {
        DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) treePath
                .getLastPathComponent();
        if (treePath.getPathCount() == 2 || (treeNode.getUserObject() instanceof SB_Folder))
        {
            setSelectionPath(treePath);
            if (treeNode.getSharedAncestor(_dragNode) != _root)
                event.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
            else
                event.getDragSourceContext().setCursor(DragSource.DefaultCopyNoDrop);
        } else
        {
            setSelectionInterval(_dragRow, _dragRow);
            event.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
        }
        return;
    }

    setSelectionInterval(_dragRow, _dragRow);

    if (ComponentRegistry.getContent().getActiveCanvas()._allowDrop)
        event.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
    else
        event.getDragSourceContext().setCursor(DragSource.DefaultCopyNoDrop);
}
 
开发者ID:StottlerHenkeAssociates,项目名称:SimBionic,代码行数:35,代码来源:SB_Catalog.java

示例14: dragEnter

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
public void dragEnter(DragSourceDragEvent e)
{
  DragSourceContext ctx = e.getDragSourceContext();

  int action = e.getDropAction();
  if ((action & DnDConstants.ACTION_COPY) != 0)
    ctx.setCursor(DragSource.DefaultCopyDrop);
  else
    ctx.setCursor(DragSource.DefaultCopyNoDrop);
}
 
开发者ID:vilie,项目名称:javify,代码行数:11,代码来源:Demo.java

示例15: dragEnter

import java.awt.dnd.DragSourceDragEvent; //导入依赖的package包/类
/**
 * Called from native code.
 */

public void dragEnter(int action, int modifiers)
{
  context.dragEnter(new DragSourceDragEvent(context, action,
                                            action
                                                & context.getSourceActions(),
                                            modifiers));
}
 
开发者ID:vilie,项目名称:javify,代码行数:12,代码来源:GtkDragSourceContextPeer.java


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