Event Handling

Advertisements

Prev Tutorial Next Tutorial

Event Handling in AWT

In general you can not perform any operation on dummy GUI screen even any button click or select any item. To perform some operation on these dummy GUI screen you need some predefined classes and interfaces. All these type of classes and interfaces are available in java.awt.event package.

Changing the state of an object is known as an event.

The process of handling the request in GUI screen is known as event handling (event represent an action). It will be changes component to component.

Note: In event handling mechanism event represent an action class and Listener represent an interface. Listener interface always contains abstract methods so here you need to write your own logic.

Event classes and Listener interfaces

Event ClassesListener Interfaces
ActionEventActionListener
MouseEventMouseListener and MouseMotionListener
MouseWheelEventMouseWheelListener
KeyEventKeyListener
ItemEventItemListener
TextEventTextListener
AdjustmentEventAdjustmentListener
WindowEventWindowListener
ComponentEventComponentListener
ContainerEventContainerListener
FocusEventFocusListener

Steps to perform Event Handling

Following steps are required to perform event handling:

  • Implement the Listener interface and overrides its methods
  • Register the component with the Listener

Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements