0N/A/*
2362N/A * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.awt.dnd;
0N/A
0N/Aimport java.awt.Component;
0N/A
0N/Aimport java.awt.event.MouseEvent;
0N/Aimport java.awt.event.MouseListener;
0N/Aimport java.awt.event.MouseMotionListener;
0N/A
0N/A/**
0N/A * This abstract subclass of <code>DragGestureRecognizer</code>
0N/A * defines a <code>DragGestureRecognizer</code>
0N/A * for mouse-based gestures.
0N/A *
0N/A * Each platform implements its own concrete subclass of this class,
0N/A * available via the Toolkit.createDragGestureRecognizer() method,
0N/A * to encapsulate
0N/A * the recognition of the platform dependent mouse gesture(s) that initiate
0N/A * a Drag and Drop operation.
0N/A * <p>
0N/A * Mouse drag gesture recognizers should honor the
0N/A * drag gesture motion threshold, available through
0N/A * {@link DragSource#getDragThreshold}.
0N/A * A drag gesture should be recognized only when the distance
0N/A * in either the horizontal or vertical direction between
0N/A * the location of the latest mouse dragged event and the
0N/A * location of the corresponding mouse button pressed event
0N/A * is greater than the drag gesture motion threshold.
0N/A * <p>
0N/A * Drag gesture recognizers created with
0N/A * {@link DragSource#createDefaultDragGestureRecognizer}
0N/A * follow this convention.
0N/A *
0N/A * @author Laurence P. G. Cable
0N/A *
0N/A * @see java.awt.dnd.DragGestureListener
0N/A * @see java.awt.dnd.DragGestureEvent
0N/A * @see java.awt.dnd.DragSource
0N/A */
0N/A
0N/Apublic abstract class MouseDragGestureRecognizer extends DragGestureRecognizer implements MouseListener, MouseMotionListener {
0N/A
0N/A private static final long serialVersionUID = 6220099344182281120L;
0N/A
0N/A /**
0N/A * Construct a new <code>MouseDragGestureRecognizer</code>
0N/A * given the <code>DragSource</code> for the
0N/A * <code>Component</code> c, the <code>Component</code>
0N/A * to observe, the action(s)
0N/A * permitted for this drag operation, and
0N/A * the <code>DragGestureListener</code> to
0N/A * notify when a drag gesture is detected.
0N/A * <P>
0N/A * @param ds The DragSource for the Component c
0N/A * @param c The Component to observe
0N/A * @param act The actions permitted for this Drag
0N/A * @param dgl The DragGestureListener to notify when a gesture is detected
0N/A *
0N/A */
0N/A
0N/A protected MouseDragGestureRecognizer(DragSource ds, Component c, int act, DragGestureListener dgl) {
0N/A super(ds, c, act, dgl);
0N/A }
0N/A
0N/A /**
0N/A * Construct a new <code>MouseDragGestureRecognizer</code>
0N/A * given the <code>DragSource</code> for
0N/A * the <code>Component</code> c,
0N/A * the <code>Component</code> to observe, and the action(s)
0N/A * permitted for this drag operation.
0N/A * <P>
0N/A * @param ds The DragSource for the Component c
0N/A * @param c The Component to observe
0N/A * @param act The actions permitted for this drag
0N/A */
0N/A
0N/A protected MouseDragGestureRecognizer(DragSource ds, Component c, int act) {
0N/A this(ds, c, act, null);
0N/A }
0N/A
0N/A /**
0N/A * Construct a new <code>MouseDragGestureRecognizer</code>
0N/A * given the <code>DragSource</code> for the
0N/A * <code>Component</code> c, and the
0N/A * <code>Component</code> to observe.
0N/A * <P>
0N/A * @param ds The DragSource for the Component c
0N/A * @param c The Component to observe
0N/A */
0N/A
0N/A protected MouseDragGestureRecognizer(DragSource ds, Component c) {
0N/A this(ds, c, DnDConstants.ACTION_NONE);
0N/A }
0N/A
0N/A /**
0N/A * Construct a new <code>MouseDragGestureRecognizer</code>
0N/A * given the <code>DragSource</code> for the <code>Component</code>.
0N/A * <P>
0N/A * @param ds The DragSource for the Component
0N/A */
0N/A
0N/A protected MouseDragGestureRecognizer(DragSource ds) {
0N/A this(ds, null);
0N/A }
0N/A
0N/A /**
0N/A * register this DragGestureRecognizer's Listeners with the Component
0N/A */
0N/A
0N/A protected void registerListeners() {
0N/A component.addMouseListener(this);
0N/A component.addMouseMotionListener(this);
0N/A }
0N/A
0N/A /**
0N/A * unregister this DragGestureRecognizer's Listeners with the Component
0N/A *
0N/A * subclasses must override this method
0N/A */
0N/A
0N/A
0N/A protected void unregisterListeners() {
0N/A component.removeMouseListener(this);
0N/A component.removeMouseMotionListener(this);
0N/A }
0N/A
0N/A /**
0N/A * Invoked when the mouse has been clicked on a component.
0N/A * <P>
0N/A * @param e the <code>MouseEvent</code>
0N/A */
0N/A
0N/A public void mouseClicked(MouseEvent e) { }
0N/A
0N/A /**
0N/A * Invoked when a mouse button has been
0N/A * pressed on a <code>Component</code>.
0N/A * <P>
0N/A * @param e the <code>MouseEvent</code>
0N/A */
0N/A
0N/A public void mousePressed(MouseEvent e) { }
0N/A
0N/A /**
0N/A * Invoked when a mouse button has been released on a component.
0N/A * <P>
0N/A * @param e the <code>MouseEvent</code>
0N/A */
0N/A
0N/A public void mouseReleased(MouseEvent e) { }
0N/A
0N/A /**
0N/A * Invoked when the mouse enters a component.
0N/A * <P>
0N/A * @param e the <code>MouseEvent</code>
0N/A */
0N/A
0N/A public void mouseEntered(MouseEvent e) { }
0N/A
0N/A /**
0N/A * Invoked when the mouse exits a component.
0N/A * <P>
0N/A * @param e the <code>MouseEvent</code>
0N/A */
0N/A
0N/A public void mouseExited(MouseEvent e) { }
0N/A
0N/A /**
0N/A * Invoked when a mouse button is pressed on a component.
0N/A * <P>
0N/A * @param e the <code>MouseEvent</code>
0N/A */
0N/A
0N/A public void mouseDragged(MouseEvent e) { }
0N/A
0N/A /**
0N/A * Invoked when the mouse button has been moved on a component
0N/A * (with no buttons no down).
0N/A * <P>
0N/A * @param e the <code>MouseEvent</code>
0N/A */
0N/A
0N/A public void mouseMoved(MouseEvent e) { }
0N/A}