Home arrow Java & J2EE arrow Page 3 - Event Handling In Java Part II

Open The Window And Inhale Java In The Air - Java

With the skills that you have developed so far from Part I of the tutorial, you can design a graphical user interface with beauty and easy. Let us refresh ourselves before we proceed, Events are method calls that Javas windowing system performs whenever any element of a user interface is manipulated.

TABLE OF CONTENTS:
  1. Event Handling In Java Part II
  2. Explicit-Event Handling
  3. Open The Window And Inhale Java In The Air
  4. Easy Steps For Coding
  5. A Glimpse Of Adapters In Java
  6. Preparing to Launch Our Java Applet And Handle Events
By: Gayathri Gokul
Rating: starstarstarstarstar / 23
September 15, 2003

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
Handling Windows Events: When you use interfaces for creating listeners, the listener class has to override all the methods that are declared in the interface. Some of the interfaces have only one method, whereas others(windowListener) have many. So even if you want to handle only a single event, you have to override all the methods. To overcome this, the event packages provide seven adapter classes, which we will see shortly. Now coming back to handle window-related events, you need to register the listener object that implements the windowListener interface. The WindowListener interface contains a set of methods that are used to handle window events.

Category Event Method
Windows Events      The user clicks on the cross button.void windowClosing (WindowEvent e)
The window opened for the first time.void windowOpened (WindowEvent e)
The window is activated.void windowActivated (WindowEvent e)
The window is deactivated.void windowDeactivated (WindowEvent e)
The window is closed.void windowClosed (WindowEvent e)
The window is minimizedvoid windowIconified (WindowEvent e)
The window maximizedvoid windowDeiconified (WindowEvent e)
In the next section we will write a sample applet so that it includes the code for window event handling.

 
 
>>> More Java & J2EE Articles          >>> More By Gayathri Gokul
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

JAVA & J2EE ARTICLES

- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: