Different types of event in Java AWT
There are many types of events that are generated by your AWT Application. These events are used to make the application more effective and
Generally, there are twelve types of event are used in Java AWT. These are as
These are twelve mentioned events are explained as follows :
- ActionEvent: This is the ActionEvent class extends from the
AWTEvent class. It indicates the component-defined events occurred
event generated by the component like Button, Checkboxes etc. The generated event is passed
to every EventListener objects that receives such types of events using the
addActionListener() method of the object.
- AdjustmentEvent: This is the AdjustmentEvent class extends from
the AWTEvent class. When the Adjustable Value is changed then the event is
- ComponentEvent: ComponentEvent class also extends from the
AWTEvent class. This class creates the low-level event which indicates if the
object moved, changed and it's states (visibility of the object). This class
only performs the notification about the state of the object. The
ComponentEvent class performs like root class for other component-level
- ContainerEvent: The ContainerEvent class extends from the
ComponentEvent class. This is a low-level event which is generated
when container's contents changes because of addition or removal of a
- FocusEvent: The FocusEvent class also extends from the
ComponentEvent class. This class indicates about the focus where the focus
has gained or lost by the object. The generated event is passed to every
objects that is registered to receive such type of events using the
addFocusListener() method of the object.
- InputEvent: The InputEvent class also extends from the
ComponentEvent class. This event class handles all the component-level input
events. This class acts as a root class for all component-level input
- ItemEvent: The ItemEvent class extends from the AWTEvent class.
The ItemEvent class handles all the indication about the selection of the
object i.e. whether selected or not. The generated event is passed to
every ItemListener objects that is registered to receive such types of event using the
addItemListener() method of the object.
- KeyEvent: KeyEvent class extends from the InputEvent class. The
KeyEvent class handles all the indication related to the key operation in
the application if you press any key for any purposes of the object then the generated event gives
the information about the pressed key. This type of events check whether the
pressed key left key or right key, 'A' or 'a' etc.
- MouseEvent: MouseEvent class also extends from the
class. The MouseEvent class handle all events generated during the mouse
operation for the object. That contains the information whether mouse is clicked or not
if clicked then checks the pressed key is left or right.
- PaintEvent: PaintEvent class also extends from the ComponentEvent
class. The PaintEvent class only ensures that the paint() or update() are
serialized along with the other events delivered from the event queue.
- TextEvent: TextEvent class extends from the AWTEvent class.
TextEvent is generated when the text of the object is changed.
The generated events are passed to every TextListener
object which is registered to receive such type of events using the
addTextListener() method of the object.
- WindowEvent : WindowEvent class extends from the ComponentEvent
class. If the window or the frame of your application is changed
(Opened, closed, activated, deactivated or any other events are generated),
WindowEvent is generated.