Event Class Assignment Help

Assignment Help: >> Event Listener - Event Class

Event Class:

GUI Event Basics AWT Event Flow, Event and Listener types

The classes which represent events are at the core of Java's event handling mechanism. Therefore, we start our study of event handling along with a tour of the event classes. As you see previously, they give a consistent, simple-to-use means of encapsulating events.

At the root of the Java event class hierarchy is EventObject that is in java.util. This event is the superclass for all events. Its one constructor is display here:

EventObject(Object src)

Above, src is the object which produces this event.

EventObject holds two methods:  getSource()  and  toString().The  getSource()

Method returns the source of the event. Its common form is display here:

Object getSource()

As expected, toString() returns the string equal of the event.

A class AWTEvent, defined inside the java.awt package, is a subclass of EventObject. This is the superclass(either directly or indirectly)of all AWT-based events used through the delegation event model. That getID() method could be used to determine the category of the event. A signature of this method is display here:

int getID()

  • For all events EventObject is a superclass.
  • For all AWT events AWT Event is a superclass which are handled through the delegation event model.

 

A package java.awt.event defines various types of events which are produced through several user interface elements. A Most important event classes are provides in the below table.

Table: Main Event Classes in java.awt.event

Event class                            Description

ActionEvent                          Produced when a button is pressed, a list item is Double- clicked, or a menu item is selected.

AdjustmentEvent                Produced when a scroll bar is manipulated.

ComponentEvent                Produced when a component is hidden, moved, resized, or becomes visible.

ContainerEvent                   Produced when a component is added to or removed from a container.

FocusEvent                           Produced when a component gains or loses keyboard focus.

InputEvent                            Abstract super class for all components input event classes

ItemEvent                            Produced when a checkbox or list item is clicked; also occurs when a choice selection is made or a checkable menu item is selected or deselected.

KeyEvent                                Produced when input is received from the keyboard.

MouseEvent                         Produced when the mouse is dragged, moved, clicked, pressed, or released; also generated when the mouse enters or exits a component.

TextEvent                              Produced when the value of a text area or text area or text field is changed.

WindowEvent                    Produced when a window is activated, closed, deactivated, deiconified, iconified, opened, or quit.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd