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


Java DropTargetDragEvent.getLocation方法代碼示例

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


在下文中一共展示了DropTargetDragEvent.getLocation方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: WidgetDropTargetDragEvent

import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
/**
 * Creates a drop target drag event.
 * @param id the event id
 * @param event the Swing event
 */
public WidgetDropTargetDragEvent (long id, DropTargetDragEvent event) {
    this.id = id;
    this.event = event;
    Point location = event.getLocation ();
    x = location.x;
    y = location.y;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:WidgetAction.java

示例2: setupDropLine

import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
private void setupDropLine( DropTargetDragEvent dtde, CategoryList list, int dropIndex ) {
    boolean verticalDropBar = list.getColumnCount() > 1;
    Rectangle rect = list.getCellBounds( dropIndex, dropIndex );
    if( verticalDropBar )
        dropBefore = dtde.getLocation().x < (rect.x + rect.width/2);
    else
        dropBefore = dtde.getLocation().y < (rect.y + rect.height/2);
    Point p1 = rect.getLocation();
    Point p2 = rect.getLocation();
    if( verticalDropBar ) {
        p2.y += rect.height;
        if( !dropBefore ) {
            p1.x += rect.width;
            p2.x += rect.width;
        }
    } else {
        p2.x += rect.width;
        if( !dropBefore ) {
            p1.y += rect.height;
            p2.y += rect.height;
        }
    }
    p1 = SwingUtilities.convertPoint( list, p1, palette.getRootPane() );
    p2 = SwingUtilities.convertPoint( list, p2, palette.getRootPane() );
    Line2D line = new Line2D.Double( p1.x, p1.y, p2.x, p2.y );
    dropPane.setDropLine( line );
    targetItem = (Item)list.getModel().getElementAt( dropIndex );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:DnDSupport.java

示例3: dragOver

import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
public void dragOver(DropTargetDragEvent e) {
  if (tab != null) {
    Point p = e.getLocation();
    int tabNumber = tab.getUI().tabForCoordinate(tab, p.x, p.y);
    if (tabNumber >= 0 && tabNumber != tab.getSelectedIndex()) {
      tab.setSelectedIndex(tabNumber);
      tab.repaint();
    }
  }
}
 
開發者ID:ajmath,項目名稱:VASSAL-src,代碼行數:11,代碼來源:MapWidget.java

示例4: dragOver

import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
public void dragOver(DropTargetDragEvent e)
{
	if (!((mxGraphTransferHandler) graphContainer.getTransferHandler())
			.isLocalDrag()
			&& JTableRenderer.this != dragSource)
	{
		Point p = e.getLocation();
		int row = rowAtPoint(p);
		getSelectionModel().setSelectionInterval(row, row);
	}
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:12,代碼來源:JTableRenderer.java

示例5: dragOver

import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
public void dragOver(DropTargetDragEvent e) {
  if (!((mxGraphTransferHandler) graphContainer.getTransferHandler()).isLocalDrag()
      && JTableRenderer.this != dragSource) {
    Point p = e.getLocation();
    int row = rowAtPoint(p);
    getSelectionModel().setSelectionInterval(row, row);
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:9,代碼來源:JTableRenderer.java

示例6: dragEnter

import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
@Override
public final void dragEnter(DropTargetDragEvent dtde) {
	Point pt = dtde.getLocation();
	int action = dtde.getDropAction();
	if (drawImage) {
		paintImage(pt);
	}
	if (controller.canPerformAction(tree, draggedNode, action, pt)) {
		dtde.acceptDrag(action);
	} else {
		dtde.rejectDrag();
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:14,代碼來源:JTreeUtil.java

示例7: dragOver

import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
@Override
public final void dragOver(DropTargetDragEvent dtde) {
	Point pt = dtde.getLocation();
	int action = dtde.getDropAction();
	autoscroll(tree, pt);
	if (drawImage) {
		paintImage(pt);
	}
	if (controller.canPerformAction(tree, draggedNode, action, pt)) {
		dtde.acceptDrag(action);
	} else {
		dtde.rejectDrag();
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:15,代碼來源:JTreeUtil.java

示例8: dropActionChanged

import java.awt.dnd.DropTargetDragEvent; //導入方法依賴的package包/類
@Override
public final void dropActionChanged(DropTargetDragEvent dtde) {
	Point pt = dtde.getLocation();
	int action = dtde.getDropAction();
	if (drawImage) {
		paintImage(pt);
	}
	if (controller.canPerformAction(tree, draggedNode, action, pt)) {
		dtde.acceptDrag(action);
	} else {
		dtde.rejectDrag();
	}
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:14,代碼來源:JTreeUtil.java


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