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


Java DragSourceDragEvent.getDragSourceContext方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: dragEnter

import java.awt.dnd.DragSourceDragEvent; //导入方法依赖的package包/类
/**
 * Drag target entered.
 *
 * @param evt
 *            Drag event
 */
@Override
public void dragEnter(DragSourceDragEvent evt) {
	// Show drag cursor
	DragSourceContext ctx = evt.getDragSourceContext();
	ctx.setCursor(cursor);
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:13,代码来源:KeyStoreEntryDragGestureListener.java

示例5: dragEnter

import java.awt.dnd.DragSourceDragEvent; //导入方法依赖的package包/类
public void dragEnter(DragSourceDragEvent event) {
    DragSourceContext context = event.getDragSourceContext(); // Q: do i need to do any of this?
    int myAction = event.getDropAction();
    if ((myAction & DnDConstants.ACTION_COPY) != 0)
	context.setCursor(DragSource.DefaultCopyDrop);
    else
	context.setCursor(DragSource.DefaultMoveDrop);
    // context.setCursor(DragSource.DefaultCopyNoDrop);
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:10,代码来源:Tree.java

示例6: dropActionChanged

import java.awt.dnd.DragSourceDragEvent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void dropActionChanged(DragSourceDragEvent dsde) {
    DragSourceContext dsc = dsde.getDragSourceContext();
    JComponent comp = (JComponent)dsc.getComponent();
    updatePartialChosen(comp, dsde.getUserAction() == MOVE);
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:9,代码来源:DefaultTransferHandler.java

示例7: dragExit

import java.awt.dnd.DragSourceDragEvent; //导入方法依赖的package包/类
/**
 * Drag target exited.
 *
 * @param evt
 *            Drag event
 */
public void dragExit(DragSourceDragEvent evt) {
	// Show no drop cursor
	DragSourceContext ctx = evt.getDragSourceContext();
	ctx.setCursor(DragSource.DefaultCopyNoDrop);
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:12,代码来源:KeyStoreEntryDragGestureListener.java


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