📌  相关文章
📜  AWT事件侦听器

📅  最后修改于: 2020-11-18 07:47:55             🧑  作者: Mango


事件侦听器代表负责处理事件的接口。 Java为我们提供了各种事件侦听器类,但我们将讨论那些更常用的类。事件侦听器方法的每个方法都有一个参数作为对象,它是EventObject类的子类。例如,鼠标事件侦听器方法将接受MouseEvent的实例,其中MouseEvent源自EventObject。

EventListner界面

它是每个侦听器接口都必须扩展的标记接口。此类在java.util包中定义。

类声明

以下是java.util.EventListener接口的声明:

public interface EventListener

AWT事件监听器接口:

以下是常用事件侦听器的列表。

Sr. No. Control & Description
1

ActionListener

This interface is used for receiving the action events.

2

ComponentListener

This interface is used for receiving the component events.

3

ItemListener

This interface is used for receiving the item events.

4

KeyListener

This interface is used for receiving the key events.

5

MouseListener

This interface is used for receiving the mouse events.

6

TextListener

This interface is used for receiving the text events.

7

WindowListener

This interface is used for receiving the window events.

8

AdjustmentListener

This interface is used for receiving the adjusmtent events.

9

ContainerListener

This interface is used for receiving the container events.

10

MouseMotionListener

This interface is used for receiving the mouse motion events.

11

FocusListener

This interface is used for receiving the focus events.