public abstract class MouseMotionAdapter extends Object implements MouseMotionListener
鼠标移动事件发生时,鼠标移动或拖动。(许多这样的事件将在一个正常的程序中生成。跟踪点击和鼠标事件,使用导入鼠标事件适配器。)
扩展这个类来创建一个MouseEvent
听众和覆盖感兴趣的事件的方法。(如果你实施MouseMotionListener
接口,你必须定义所有的方法在这。这个抽象类定义了他们所有的空方法,所以你只能定义你关心的事件的方法。)
创建一个使用扩展类的听众对象然后登记与组件使用组件的addMouseMotionListener
方法。当鼠标移动或拖,在监听对象相关的方法被调用时,MouseEvent
传递给它。
MouseEvent
,
MouseMotionListener
,
Tutorial: Writing a Mouse Motion Listener
Constructor and Description |
---|
MouseMotionAdapter() |
Modifier and Type | Method and Description |
---|---|
void |
mouseDragged(MouseEvent e)
当鼠标按钮被按下一个组件,然后拖动时调用。
|
void |
mouseMoved(MouseEvent e)
当鼠标按钮被移动到一个组件(有没有按钮没有下降)。
|
public void mouseDragged(MouseEvent e)
mouseDragged
接口
MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
接口
MouseMotionListener
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.