Java
  Home arrow Java arrow Page 3 - Event Handling In Java
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBMฎ developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
JAVA

Event Handling In Java
By: Gayathri Gokul
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 146
    2003-09-11


    Table of Contents:
  • Event Handling In Java
  • Going Into Over Drive
  • Relax Back Event Handling In A Nut Shell
  • Event-Handling In Java
  • Amazingly Simple Applets
  • Naughty Examples For Those Little Mice
  • A Quick Recap

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Event Handling In Java - Relax Back Event Handling In A Nut Shell
    ( Page 3 of 7 )

    Semantic events are defined at a higher-level to encapsulate the semantics of user interface component’s model. Now let us see what are the various semantic event classes and what they generate:

    • An ActionEvent object is generated when a component is activated

    • An AdjustmentEvent Object is generated when scrollbars and other adjustment elements are used.

    • A TextEvent object is generated when text of a component is modified.

    • An ItemEvent is generated when an item from a list, a choice or checkbox is selected.

    Low-Level Events is one that represents a low-level input or windows-system occurrence on a visual component on the screen. The various low-level event classes and what they generate are as follows:

    • A ContainerEvent Object is generated when component are added or removed from container.

    • A ComponentEvent object is generated when a component is resized, moved etc.

    • A FocusEvent object is generated when component receives focus for input.

    • A KeyEvent object is generated when key on keyboard is pressed, released etc.

    • A WindowEvent object is generated when a window activity, like maximizing or close occurs.

    • A MouseEvent object is generated when a mouse is used.

    • A PaintEvent object is generated when component is painted.

    Event Listeners: An object delegates the task of handling an event to an event listener. When an event occurs, an event object of the appropriate type (as illustrated below) is created. This object is passed to a Listener. A listener must implement the interface that has the method for event handling. A component can have multiple listeners, and a listener can be removed using removeActionListener () method. Next question in your mind must be what is an interface?. An Interface contains constant values and method declaration. The difference between classes and interface is that the methods in an interface are only declared and not implemented, that is, the methods do not have a body. What is the Need for interface? Are interfaces are used to define behavior protocols (standard behavior) that can be implemented by any class anywhere in the class hierarchy. The java.awt.event package contains definitions of all event classes and listener interface. The semantic listener interfaces define by AWT for the above mentioned semantic events are:

    • ActionListener

    • AjdustmentListener

    • ItemListener

    • TextListener

    The low-level event listeners are as follows:

    • ComponentListener

    • ContainerListener

    • FocusListener

    • KeyListener

    • MouseListener

    • MouseMotionListener

    • WindowsListener.



     
     
    >>> More Java Articles          >>> More By Gayathri Gokul
     

       

    JAVA ARTICLES

    - Exception Handling Techniques in Java
    - More About Multithreading in Java
    - The Basics of Multiple Threads in Java
    - Data Access Using Spring Framework JDBC
    - New Object Initialization in Java
    - Adding Images With iTextSharp
    - Adding Columns With iTextSharp
    - Creating Simple PDF Files With iTextSharp
    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek