home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / awt / dnd / DropTargetDragEvent.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  1.9 KB  |  101 lines

  1. /*
  2.  * @(#)DropTargetDragEvent.java    1.5 98/03/18
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.awt.dnd;
  16.  
  17. import java.awt.Point;
  18.  
  19. import java.awt.datatransfer.DataFlavor;
  20.  
  21. import java.awt.dnd.DropTargetEvent;
  22.  
  23. /**
  24.  * <p>
  25.  * The DropTargetDragEvent is delivered to a DropTargetListener via its
  26.  * dragEnter(), dragOver(), and dragScroll() methods.
  27.  * </p>
  28.  *
  29.  * @version 1.5
  30.  * @since JDK1.2
  31.  *
  32.  */
  33.  
  34. public class DropTargetDragEvent extends DropTargetEvent {
  35.  
  36.     /**
  37.      * construct an Event
  38.      */
  39.  
  40.     public DropTargetDragEvent(DropTargetContext dtc, Point cursorLocn, int dropAction, int srcActions)  {
  41.     super(dtc);
  42.  
  43.     location        = cursorLocn;
  44.     actions         = srcActions;
  45.     this.dropAction = dropAction;
  46.     }
  47.  
  48.     /**
  49.      * @return the current cursor location in Component's coords.
  50.      */
  51.  
  52.     public Point getLocation() {
  53.     return location;
  54.     }
  55.  
  56.  
  57.     /**
  58.      * @return current DataFlavors
  59.      */
  60.  
  61.     public DataFlavor[] getCurrentDataFlavors() {
  62.     return context.getCurrentDataFlavors();
  63.     }
  64.  
  65.     /**
  66.      * @return source actions
  67.      */
  68.  
  69.     public int getSourceActions() { return actions; }
  70.  
  71.     /**
  72.      * @return currently selected drop action
  73.      */
  74.  
  75.     public int getDropAction() { return dropAction; }
  76.  
  77.     /**
  78.      * Accept the drag
  79.      */
  80.  
  81.     public void acceptDrag(int dragOperation) {
  82.     context.acceptDrag(dragOperation);
  83.     }
  84.  
  85.     /**
  86.      * Reject the drag
  87.      */
  88.  
  89.     public void rejectDrag() {
  90.     context.rejectDrag();
  91.     }
  92.  
  93.     /*
  94.      * fields
  95.      */
  96.  
  97.     private Point        location;
  98.     private int            actions;
  99.     private int            dropAction;
  100. }
  101.