Example usage for java.awt.dnd DragSourceDragEvent getLocation

List of usage examples for java.awt.dnd DragSourceDragEvent getLocation

Introduction

In this page you can find the example usage for java.awt.dnd DragSourceDragEvent getLocation.

Prototype

public Point getLocation() 

Source Link

Document

This method returns a Point indicating the cursor location in screen coordinates at the moment this event occurred, or null if the cursor location is not specified for this event.

Usage

From source file:com.qspin.qtaste.ui.TestCaseTree.java

public void dragOver(DragSourceDragEvent dsde) {
    //// w  w  w . j a v  a2  s . c om
    Point dropPoint = dsde.getLocation();
    TreePath path = getPathForLocation(dropPoint.x, dropPoint.y);
    if (path == null)
        return;
    Object targetNode = path.getLastPathComponent();
    if (targetNode instanceof TCTreeNode) {
        TCTreeNode tcTreeNode = (TCTreeNode) targetNode;
        if (tcTreeNode.getUserObject() instanceof FileNode) {
            FileNode fn = (FileNode) tcTreeNode.getUserObject();
        }
    }
}

From source file:org.rdv.ui.DataPanelContainer.java

public void dragOver(DragSourceDragEvent e) {
    Point dragPoint = e.getLocation();
    Point containerLocation = getLocationOnScreen();
    dragPoint.translate(-containerLocation.x, -containerLocation.y);

    Component overComponent = getComponentAt(dragPoint);
    Component dragComponent = e.getDragSourceContext().getComponent();

    if (overComponent != null && overComponent != dragComponent) {
        moveBefore(dragComponent, overComponent);
    }// www  .  j av  a2s.  c o m
}