本文整理汇总了Java中java.awt.dnd.DragSourceDragEvent.getLocation方法的典型用法代码示例。如果您正苦于以下问题:Java DragSourceDragEvent.getLocation方法的具体用法?Java DragSourceDragEvent.getLocation怎么用?Java DragSourceDragEvent.getLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.dnd.DragSourceDragEvent
的用法示例。
在下文中一共展示了DragSourceDragEvent.getLocation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dragMouseMoved
import java.awt.dnd.DragSourceDragEvent; //导入方法依赖的package包/类
@Override
public void dragMouseMoved(DragSourceDragEvent dsde) {
if (dragInfo != null) {
JhromeTabbedPaneUI draggedParent = SwingUtils.getJTabbedPaneAncestorUI(dragInfo.tab);
if (draggedParent != null) {
Point p = dsde.getLocation();
SwingUtilities.convertPointFromScreen(p, draggedParent.tabbedPane);
if (!Utils.contains(draggedParent.dropZone, p)) {
dragOut(dsde.getDragSourceContext().getComponent(), dragInfo);
}
}
if (dragInfo.floatingTabHandler != null) {
dragInfo.floatingTabHandler.onFloatingTabDragged(dsde, dragInfo.tab, dragInfo.grabX);
}
}
}
示例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();
}
}
示例3: dragMouseMoved
import java.awt.dnd.DragSourceDragEvent; //导入方法依赖的package包/类
public void dragMouseMoved(DragSourceDragEvent event) {
if (!event.getLocation().equals(lastDragLocation)) {
lastDragLocation = event.getLocation();
moveDragCursor(event.getX(), event.getY());
if (dragCursor != null && !dragCursor.isVisible()) {
dragCursor.setVisible(true);
}
}
}
示例4: dragMouseMoved
import java.awt.dnd.DragSourceDragEvent; //导入方法依赖的package包/类
public void dragMouseMoved(DragSourceDragEvent e) {
if (!e.getLocation().equals(lastDragLocation)) {
lastDragLocation = e.getLocation();
moveDragCursor(e.getX(), e.getY());
if (dragCursor != null && !dragCursor.isVisible()) {
dragCursor.setVisible(true);
}
}
}
示例5: dragOver
import java.awt.dnd.DragSourceDragEvent; //导入方法依赖的package包/类
public void dragOver(DragSourceDragEvent event)
{
Point location = event.getLocation();
Point screenLocation = getLocationOnScreen();
TreePath treePath = getPathForLocation(location.x - screenLocation.x, location.y
- screenLocation.y);
if (treePath != null
&& ((_dragNode.getUserObject() instanceof SB_Function) || (_dragNode
.getUserObject() instanceof SB_Folder)))
{
DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) treePath
.getLastPathComponent();
if (treePath.getPathCount() == 2 || (treeNode.getUserObject() instanceof SB_Folder))
{
setSelectionPath(treePath);
if (treeNode.getSharedAncestor(_dragNode) != _root)
event.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
else
event.getDragSourceContext().setCursor(DragSource.DefaultCopyNoDrop);
} else
{
setSelectionInterval(_dragRow, _dragRow);
event.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
}
return;
}
setSelectionInterval(_dragRow, _dragRow);
if (ComponentRegistry.getContent().getActiveCanvas()._allowDrop)
event.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop);
else
event.getDragSourceContext().setCursor(DragSource.DefaultCopyNoDrop);
}