Example usage for java.awt Point equals

List of usage examples for java.awt Point equals

Introduction

In this page you can find the example usage for java.awt Point equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Determines whether or not two points are equal.

Usage

From source file:uk.co.modularaudio.util.swing.dndtable.layeredpane.LayeredPaneDndTableMouseListener.java

@Override
public void mouseMoved(final MouseEvent e) {
    try {//from   w w w  .  j  a  va2s  .  c o  m
        final State curState = dndState.getCurrentState();
        final Point tablePoint = e.getPoint();
        //         log.debug("Mouse moved point: " + tablePoint);
        decorationManager.setMouseLocation(tablePoint);
        final boolean foundIt = table.getComponentAtWithLocalPoint(tablePoint, componentAndLocalPoint);
        Point point = null;
        C component = null;
        if (foundIt) {
            point = componentAndLocalPoint.getHead();
            component = componentAndLocalPoint.getTail();
        }
        switch (curState) {
        case BROWSING:
            if (dndPolicy.isMouseOverDndSource(table, component, point, tablePoint)) {
                dndState.changeTo(State.MOUSE_OVER_DRAGGABLE_AREA);
            }
            break;
        case MOUSE_OVER_DRAGGABLE_AREA:
            if (!dndPolicy.isMouseOverDndSource(table, component, point, tablePoint)) {
                dndState.changeTo(State.BROWSING);
            }
            break;
        case DURING_DRAG:
            // Probably a bit of mouse movement after releasing a drag
            // but we haven't processed the drag end yet.
            if (!point.equals(OFFSCREEN_MOUSE_MOVE_POINT)) {
                log.error("Got a 'during_drag' state but we shouldn't receive these.");
                // Reset the state
                dndState.changeTo(State.BROWSING);
            } else {
                // It's okay, expected "clearUpDecorations"
            }
            break;
        default:
            break;
        }
    } catch (final Exception e1) {
        final String msg = "Exception caught during mouse movement processing: " + e1.toString();
        log.error(msg, e1);
    }
}

From source file:VASSAL.build.module.map.PieceMover.java

/** Invoked just before a piece is moved */
protected Command movedPiece(GamePiece p, Point loc) {
    setOldLocation(p);/*w  w w  .j a  v  a  2 s . c  o  m*/
    Command c = null;
    if (!loc.equals(p.getPosition())) {
        c = markMoved(p, true);
    }
    if (p.getParent() != null) {
        final Command removedCommand = p.getParent().pieceRemoved(p);
        c = c == null ? removedCommand : c.append(removedCommand);
    }
    return c;
}