本文整理汇总了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;
}
示例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 );
}
示例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();
}
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}