eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Resources
 ::   Tutorials
 ::   Presentations
Perl & CGI tutorials
 ::   Intro to Perl/CGI and HTML Forms
 ::   Intro to Windows Perl
 ::   Intro to Perl 5
 ::   Intro to Perl
 ::   Intro to Perl Taint mode
 ::   Sherlock Holmes and the Case of the Broken CGI Script
 ::   Writing COM Components in Perl

Java tutorials
 ::   Intro to Java
 ::   Cross Browser Java

Misc technical tutorials
 ::   Intro to The Web Application Development Environment
 ::   Introduction to XML
 ::   Intro to Web Design
 ::   Intro to Web Security
 ::   Databases for Web Developers
 ::   UNIX for Web Developers
 ::   Intro to Adobe Photoshop
 ::   Web Programming 101
 ::   Introduction to Microsoft DNA

Misc non-technical tutorials
 ::   Misc Technopreneurship Docs
 ::   What is a Webmaster?
 ::   What is the open source business model?
 ::   Technical writing
 ::   Small and mid-sized businesses on the Web

Offsite tutorials
 ::   ISAPI Perl Primer
 ::   Serving up web server basics
 ::   Introduction to Java (Parts 1 and 2) in Slovak

 

Introduction to Web Programming
Events  
  • In this section, we examine how to make your programs respond to events. In the most basic terms, events occur when something happens. The most common events are caused by user interaction. For example, events occur when a user presses the mouse button, releases the mouse button, or presses a key on the keyboard.

  • Events are also generated without user involvement, such as when code programmatically selects items and generates an event.

  • After an event occurs, it's then up to your program to determine the appropriate response.

  • User-interface components can both listen for events such as key and mouse presses, and also generate events of their own. For example, a button listens for a mouse press and release that occurs over itself. When one occurs, the button posts its own event (an action event).

  • Dealing with events can be complicated because there are two different event models to choose from since the JDK changed the way events were handled between the JDK 1.0 and JDK 1.1 releases.

  • The JDK 1.0 release from Sun contains a very simple method of event handling. Events are sent to the component where they occur and then sent to that component's parents. You can simply subclass a component or one of the component's parents to implement a method to handle events.

  • The JDK 1.1 release introduced a new way to deal with events. In the 1.1 model, events are distributed using delegation. Objects register themselves as being interested in receiving events from other objects. The JDK 1.1 model uses listeners and adapters that allow you to separate user-interface and event-handling code. It also allows any object, not just a user-interface component, to receive events from a component.

Previous Page | Next Page