SunQuest
 
       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  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBMฎ developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
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? 
JAVA

Event Handling In Java
By: Gayathri Gokul
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 118
    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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    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

    - 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...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup

    BlackBerry VTS




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway