當前位置: 首頁>>代碼示例>>Java>>正文


Java DragSourceDragEvent.getDropAction方法代碼示例

本文整理匯總了Java中java.awt.dnd.DragSourceDragEvent.getDropAction方法的典型用法代碼示例。如果您正苦於以下問題:Java DragSourceDragEvent.getDropAction方法的具體用法?Java DragSourceDragEvent.getDropAction怎麽用?Java DragSourceDragEvent.getDropAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.dnd.DragSourceDragEvent的用法示例。


在下文中一共展示了DragSourceDragEvent.getDropAction方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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包/類
@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

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

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

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

示例7: dragEnter

import java.awt.dnd.DragSourceDragEvent; //導入方法依賴的package包/類
@Override
public final void dragEnter(final DragSourceDragEvent dsde) {
  final 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:google,項目名稱:binnavi,代碼行數:14,代碼來源:AbstractTreeTransferHandler.java

示例8: dragOver

import java.awt.dnd.DragSourceDragEvent; //導入方法依賴的package包/類
@Override
public final void dragOver(final DragSourceDragEvent dsde) {
  final 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:google,項目名稱:binnavi,代碼行數:14,代碼來源:AbstractTreeTransferHandler.java

示例9: dropActionChanged

import java.awt.dnd.DragSourceDragEvent; //導入方法依賴的package包/類
@Override
public final void dropActionChanged(final DragSourceDragEvent dsde) {
  final 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:google,項目名稱:binnavi,代碼行數:14,代碼來源:AbstractTreeTransferHandler.java

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


注:本文中的java.awt.dnd.DragSourceDragEvent.getDropAction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。