mouserightdraggesturerecognizer.java
来自「JavaExplorer是一个独立于平台的浏览器」· Java 代码 · 共 189 行
JAVA
189 行
package javaexplorer.gui.dnd;/* * @(#)MouseDragGestureRecognizer.java 1.9 00/02/02 * * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved. * * This software is the proprietary information of Sun Microsystems, Inc. * Use is subject to license terms. * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */import java.awt.Component;import java.awt.dnd.*;import java.awt.event.MouseEvent;import java.awt.event.MouseListener;import java.awt.event.MouseMotionListener;/** * This abstract subclass of <code>DragGestureRecognizer</code> * defines a <code>DragGestureRecognizer</code> * for mouse based gestures. * * Each platform will implement its own concrete subclass of this class, * available via the Toolkit.createDragGestureRecognizer() method, * to encapsulate * the recognition of the platform dependent mouse gesture(s) that initiate * a Drag and Drop operation. * * @author Laurence P. G. Cable * @version 1.9 * * @see java.awt.dnd.DragGestureListener * @see java.awt.dnd.DragGestureEvent * @see java.awt.dnd.DragSource */public abstract class MouseRightDragGestureRecognizer extends DragGestureRecognizer implements MouseListener, MouseMotionListener { /** * Construct a new <code>MouseDragGestureRecognizer</code> * given the <code>DragSource</code> for the * <code>Component</code> c, the <code>Component</code> * to observe, the action(s) * permitted for this drag operation, and * the <code>DragGestureListener</code> to * notify when a drag gesture is detected. * <P> * @param ds The DragSource for the Component c * @param c The Component to observe * @param act The actions permitted for this Drag * @param dgl The DragGestureListener to notify when a gesture is detected * */ protected MouseRightDragGestureRecognizer(DragSource ds, Component c, int act, DragGestureListener dgl) { super(ds, c, act, dgl); } /** * Construct a new <code>MouseDragGestureRecognizer</code> * given the <code>DragSource</code> for * the <code>Component</code> c, * the <code>Component</code> to observe, and the action(s) * permitted for this drag operation. * <P> * @param ds The DragSource for the Component c * @param c The Component to observe * @param act The actions permitted for this drag */ protected MouseRightDragGestureRecognizer(DragSource ds, Component c, int act) { this(ds, c, act, null); } /** * Construct a new <code>MouseDragGestureRecognizer</code> * given the <code>DragSource</code> for the * <code>Component</code> c, and the * <code>Component</code> to observe. * <P> * @param ds The DragSource for the Component c * @param c The Component to observe */ protected MouseRightDragGestureRecognizer(DragSource ds, Component c) { this(ds, c, DnDConstants.ACTION_NONE); } /** * Construct a new <code>MouseDragGestureRecognizer</code> * given the <code>DragSource</code> for the <code>Component</code>. * <P> * @param ds The DragSource for the Component */ protected MouseRightDragGestureRecognizer(DragSource ds) { this(ds, null); } /** * register this DragGestureRecognizer's Listeners with the Component */ protected void registerListeners() { component.addMouseListener(this); component.addMouseMotionListener(this); } /** * unregister this DragGestureRecognizer's Listeners with the Component * * subclasses must override this method */ protected void unregisterListeners() { component.removeMouseListener(this); component.removeMouseMotionListener(this); } /** * Invoked when the mouse has been clicked on a component. * <P> * @param e the <code>MouseEvent</code> */ public void mouseClicked(MouseEvent e) { } /** * Invoked when a mouse button has been * pressed on a <code>Component</code>. * <P> * @param e the <code>MouseEvent</code> */ public void mousePressed(MouseEvent e) { } /** * Invoked when a mouse button has been released on a component. * <P> * @param e the <code>MouseEvent</code> */ public void mouseReleased(MouseEvent e) { } /** * Invoked when the mouse enters a component. * <P> * @param e the <code>MouseEvent</code> */ public void mouseEntered(MouseEvent e) { } /** * Invoked when the mouse exits a component. * <P> * @param e the <code>MouseEvent</code> */ public void mouseExited(MouseEvent e) { } /** * Invoked when a mouse button is pressed on a component. * <P> * @param e the <code>MouseEvent</code> */ public void mouseDragged(MouseEvent e) { } /** * Invoked when the mouse button has been moved on a component * (with no buttons no down). * <P> * @param e the <code>MouseEvent</code> */ public void mouseMoved(MouseEvent e) { }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?