📜  SWING-事件监听器

📅  最后修改于: 2020-11-10 04:47:59             🧑  作者: Mango


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

EventListner界面

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

类声明

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

public interface EventListener

SWING事件监听器接口

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

Sr.No. Class & 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 WindowListener

This interface is used for receiving the window events.

7 AdjustmentListener

This interface is used for receiving the adjustment events.

8 ContainerListener

This interface is used for receiving the container events.

9 MouseMotionListener

This interface is used for receiving the mouse motion events.

10 FocusListener

This interface is used for receiving the focus events.