Saturday, February 23, 2019

AWT Event Classes

The Event classes represent the event. Java provides us various Event classes but we will discuss those which are more frequently used.

EventObject class

It is the root class from which all event state objects shall be derived. All Events are constructed with a reference to the object, the source, that is logically deemed to be the object upon which the Event in question initially occurred upon.This class is defined in java.util package.

Class declaration

Following is the declaration for java.util.EventObject class:
public class EventObject
   extends Object
      implements Serializable

Field

Following are the fields for java.util.EventObject class:
  • protected Object source -- The object on which the Event initially occurred.

Class constructors

S.N.Constructor & Description
1
EventObject(Object source)
Constructs a prototypical Event.

Class methods

S.N.Method & Description
1
Object getSource()
The object on which the Event initially occurred.
2
String toString()
Returns a String representation of this EventObject.

Methods inherited

This class inherits methods from the following classes:
  • java.lang.Object

AWT Event Classes:

Following is the list of commonly used event classes.
Sr. No.Control & Description
1
It is the root event class for all AWT events. This class and its subclasses supercede the original java.awt.Event class.
2
The ActionEvent is generated when button is clicked or the item of a list is double clicked.
3
The InputEvent class is root event class for all component-level input events.
4
On entering the character the Key event is generated.
5
This event indicates a mouse action occurred in a component.
6
The object of this class represents the text events.
7
The object of this class represents the change in state of a window.
8
The object of this class represents the adjustment event emitted by Adjustable objects.
9
The object of this class represents the change in state of a window.
10
The object of this class represents the change in state of a window.
11
The object of this class represents the change in state of a window.
12
The object of this class represents the change in state of a window.

No comments:

Post a Comment

Popular Posts