1 /*
   2  * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.awt.dnd;
  27 
  28 import java.awt.Insets;
  29 import java.awt.Point;
  30 
  31 /**
  32  * During DnD operations it is possible that a user may wish to drop the
  33  * subject of the operation on a region of a scrollable GUI control that is
  34  * not currently visible to the user.
  35  * <p>
  36  * In such situations it is desirable that the GUI control detect this
  37  * and institute a scroll operation in order to make obscured region(s)
  38  * visible to the user. This feature is known as autoscrolling.
  39  * <p>
  40  * If a GUI control is both an active {@code DropTarget}
  41  * and is also scrollable, it
  42  * can receive notifications of autoscrolling gestures by the user from
  43  * the DnD system by implementing this interface.
  44  * <p>
  45  * An autoscrolling gesture is initiated by the user by keeping the drag
  46  * cursor motionless with a border region of the {@code Component},
  47  * referred to as
  48  * the "autoscrolling region", for a predefined period of time, this will
  49  * result in repeated scroll requests to the {@code Component}
  50  * until the drag {@code Cursor} resumes its motion.
  51  *
  52  * @since 1.2
  53  */
  54 
  55 public interface Autoscroll {
  56 
  57     /**
  58      * This method returns the {@code Insets} describing
  59      * the autoscrolling region or border relative
  60      * to the geometry of the implementing Component.
  61      * <P>
  62      * This value is read once by the {@code DropTarget}
  63      * upon entry of the drag {@code Cursor}
  64      * into the associated {@code Component}.
  65      *
  66      * @return the Insets
  67      */
  68 
  69     public Insets getAutoscrollInsets();
  70 
  71     /**
  72      * notify the {@code Component} to autoscroll
  73      *
  74      * @param cursorLocn A {@code Point} indicating the
  75      * location of the cursor that triggered this operation.
  76      */
  77 
  78     public void autoscroll(Point cursorLocn);
  79 
  80 }