Home Java Example Java Awt Different types of event in Java AWT
Questions:Ask|Latest


 
 

Share on Google+Share on Google+

Different types of event in Java AWT

Advertisement
In this section, you will learn about all types of listeners and its description.

Different types of event in Java AWT

     

Introduction

There are many types of events that are generated by your AWT Application. These events are used to make the application more effective and efficient. Generally, there are twelve types of event are used in Java AWT. These are as follows : 

  1. ActionEvent
  2. AdjustmentEvent
  3. ComponentEvent
  4. ContainerEvent
  5. FocusEvent
  6. InputEvent
  7. ItemEvent
  8. KeyEvent
  9. MouseEvent
  10. PaintEvent
  11. TextEvent
  12. WindowEvent

These are twelve mentioned events are explained as follows : 

  1. ActionEvent: This is the ActionEvent class extends from the AWTEvent class. It indicates the component-defined events occurred i.e. the 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.
     
  2. AdjustmentEvent: This is the AdjustmentEvent class extends from the AWTEvent class. When the Adjustable Value is changed then the event is generated.
     
  3. 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 events.
      
  4. 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 components.
     
  5. 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.
     
  6. 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 events.
     
  7. 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.
     
  8. 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.
     
  9. MouseEvent: MouseEvent class also extends from the InputEvent 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.
     
  10. 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.
      
  11. 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.
     
  12. 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.
Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 17, 2007

Ask Questions?    Discuss: Different types of event in Java AWT   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
prasan
June 13, 2011
java main

where can i find main() method in java api , i want to see method signature
Mitesh G Patel
September 24, 2011
Event Types

This is very nice containt for event types...any one found a quit knowledge on this topic..........thank you thank a lot...
ajitha
January 12, 2013
java

good subject
Erika Mae
February 14, 2012
Events

I am an Information technology student, I just wanna ask, Is it needed to compose a method or not?
santosh kumar verma
April 9, 2014
java

why do we used void only in java befor main()
DMCA.com