📜  AWT事件类

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


Event类代表事件。 Java为我们提供了各种Event类,但我们将讨论更常用的类。

EventObject类

它是从其派生所有事件状态对象的根类。所有事件都是通过对对象source的引用构造的,该对象在逻辑上被认为是最初发生有关事件的对象。此类在java.util包中定义。

类声明

以下是java.util.EventObject类的声明:

public class EventObject
   extends Object
      implements Serializable

领域

以下是java.util.EventObject类的字段:

  • 受保护的对象源-事件最初发生在的对象。

类的构造函数

S.N. Constructor & Description
1

EventObject(Object source)

Constructs a prototypical Event.

类方法

S.N. Method & Description
1

Object getSource()

The object on which the Event initially occurred.

2

StringtoString()

Returns a String representation of this EventObject.

方法继承

此类从以下类继承方法:

  • java.lang.Object

AWT事件类别:

以下是常用事件类的列表。

Sr. No. Control & Description
1

AWTEvent

It is the root event class for all AWT events. This class and its subclasses supercede the original java.awt.Event class.

2

ActionEvent

The ActionEvent is generated when button is clicked or the item of a list is double clicked.

3

InputEvent

The InputEvent class is root event class for all component-level input events.

4

KeyEvent

On entering the character the Key event is generated.

5

MouseEvent

This event indicates a mouse action occurred in a component.

6

TextEvent

The object of this class represents the text events.

7

WindowEvent

The object of this class represents the change in state of a window.

8

AdjustmentEvent

The object of this class represents the adjustment event emitted by Adjustable objects.

9

ComponentEvent

The object of this class represents the change in state of a window.

10

ContainerEvent

The object of this class represents the change in state of a window.

11

MouseMotionEvent

The object of this class represents the change in state of a window.

12

PaintEvent

The object of this class represents the change in state of a window.