当前位置: 首页>>代码示例>>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;未经允许,请勿转载。