home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-20 | 2.7 KB | 132 lines |
- /*
- * @(#)DropTargetDropEvent.java 1.4 98/03/18
- *
- * Copyright 1997, 1998 by Sun Microsystems, Inc.,
- * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of Sun Microsystems, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Sun.
- */
-
- package java.awt.dnd;
-
- import java.awt.Point;
-
- import java.awt.datatransfer.DataFlavor;
- import java.awt.datatransfer.Transferable;
-
- import java.awt.dnd.DropTargetEvent;
-
- /**
- * <p>
- * The DropTargetDropEvent is delivered via the DropTargetListener drop()
- * method.
- * </p>
- *
- * @version 1.4
- * @since JDK1.2
- *
- */
-
- public class DropTargetDropEvent extends DropTargetEvent {
-
- /**
- * Construct a DropTargetEvent
- */
-
- public DropTargetDropEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions) {
- super(dtc);
-
- location = cursorLocn;
- actions = srcActions;
- this.dropAction = dropAction;
- }
-
- /**
- * Construct a DropTargetEvent
- */
-
- public DropTargetDropEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions, boolean isLocal) {
- this(dtc, cursorLocn, srcActions, dropAction);
-
- isLocalTx = isLocal;
- }
-
- /**
- * @return the current cursor location in Component's coords.
- */
-
- public Point getLocation() {
- return location;
- }
-
-
- /**
- * @return current DataFlavors
- */
-
- public DataFlavor[] getCurrentDataFlavors() {
- return context.getCurrentDataFlavors();
- }
-
- /**
- * @return source actions
- */
-
- public int getSourceActions() { return actions; }
-
- /**
- * @return source actions
- */
-
- public int getDropAction() { return dropAction; }
-
- /**
- * @return the Transferable associated with the drop
- */
-
- public Transferable getTransferable() {
- return getDropTargetContext().getTransferable();
- }
-
- /**
- * accept the Drop, using the specified operation.
- */
-
- public void acceptDrop(int dropAction) {
- getDropTargetContext().acceptDrop(dropAction);
- }
-
- /**
- * reject the Drop.
- */
-
- public void rejectDrop() {
- getDropTargetContext().rejectDrop();
- }
-
- /**
- * @return if the Source is in the same JVM
- */
-
- public boolean isLocalTransfer() {
- return isLocalTx;
- }
-
- /*
- * fields
- */
-
- static final private Point zero = new Point(0,0);
-
- private Point location = zero;
- private int actions = DnDConstants.ACTION_NONE;
- private int dropAction = DnDConstants.ACTION_NONE;
-
- private boolean isLocalTx = false;
- }
-