|
Working with events in Java
Fundamental Java APIs like Abstract Window Toolkit (AWT) and Swing, not to mention Java Media Framework (JMF), Java Platform Debugger Architecture (JPDA), and JavaBeans, depend heavily on events. Events are an integral part of the Java platform. In this article, I'll present the concepts behind event-driven applications and look at various methods of event handling. Then, I'll discuss some generic techniques you can use to simplify the task of handling events.
|
|
DRAWING AWT COMPONENTS
The paint method is the fundamental means by which an AWT component (Q5.1) draws itself on the screen. You need to define paint in your own code if you subclass from a Component class that does not already know how to draw itself—most commonly Canvas, Panel, or Applet. Other Component subclasses, such as Button and TextField, know how to draw themselves, and need no further help from you.
|
|
Introduction to the AWT
This article provides an introduction to the AWT (or Abstract Windowing Toolkit). The AWT is the user interface toolkit provided as part of the Java language class library. This article covers some of the philosophy behind the AWT and addresses the practical concern of how to create a simple user interface for an applet or application.
|
|
Creating a User Interface (AWT Only)
The JavaTM programming language provides a class library called the Abstract Window Toolkit (AWT) that contains a number of common graphical widgets. You can add these widgets to your display area and position them with a layout manager.
|
|
AWT Fundamentals
The JavaTM programming language provides a class library called the Abstract Window Toolkit (AWT) that contains a number of common graphical widgets. You can add these widgets to your display area and position them with a layout manager.
|
|
Overview of the Java UI
This lesson gives an overview of what the Java environment provides to help you create a user interface (UI). UI is a broad term that refers to all sorts of communication between a program and its users. UI is not only what the user sees, but what the user hears and feels. Even the speed with which a program interacts with the user is an important part of the program's UI.
|
|
AWT Components
We strongly recommend that instead of using the AWT components shown on this page, you use Swing components instead. The Swing components, which are part of the Java Foundation Classes (JFC), can be used with either JDK 1.1 or JDK 1.2.
|
|
Using the AWT Components
Unless otherwise noted, the component-specific text in this page and the pages that follow reflects 1.0, not 1.1.
|
|
The 1.1 AWT Event Model
In the 1.1 AWT event model, events are generated by event sources. One or more listeners can register to be notified about events of a particular kind from a particular source. Sometimes this model is called delegation, since it allows the programmer to delegate authority for event handling to any object that implements the appropriate listener interface. The 1.1 AWT event model lets you both handle and generate AWT events.
|
|
Events Generated by AWT Components
This table lists the kinds of events that each 1.1 AWT component can generate.
|
|
The Anatomy of a GUI-Based Program
This page and the ones that follow pick apart a simple Java program that has a graphical UI
|
|
Introduction to the AWT
AWT stands for Abstract Window ToolKit. It is a portable GUI library between Solaris and Windows 95/NT and Mac System 7.X(soon) for stand-alone applications and/or applets. Since it can be used in applets it can be used on IRIX, SunOS, HP/UX, Linux which Netscape 2.0 supports.
|
|
The AWT Tutorial
This tutorial has been re-written to accommodate applets as well as applications. The previous tutorial focused on the latter and ignored the former due to the author's original disgust at such 'toys', but have now seen the light and decided applets can be extremely useful for educational purposes(among other things).
|
|
AWT Events
Event objects in the JDK 1.0.2 can carry information about the event's source, the event type, when and where the event occurred, the state of the keyboard for the event, and the state of the component affected by the event.
|
|
Patterns in Java AWT
A pattern describes a problem which occurs over and over again, and then describes the core of the solution to that problem in such a way that you can use this solution without ever doing it the same way twice.
|
|
Innovative ways to handle events in AWT and JFC
After a brief introduction to traditional event-handling models, Satheesh Donthy describes three alternative ways to connect AWT or JFC event sources with any event targets using five utility classes.
|
|
THE JAVA AWT DELEGATION EVENT MODEL
With the introduction of Java Development Kit (JDK) 1.1, the architecture of the Abstract Window Toolkit (AWT) has significantly improved -- especially in the event model and the ability to create lightweight components
|
|
AWT/Swing Tutorial
This tutorial gives a brief overview of working with AWT and Swing. This is by no means a comprehensive overview of both widget sets, and is restricted to elements used in applets. The reader is encouraged to explore other components of the two widget sets, especially for Swing. As this tutorial is restricted to applets, frames and widgets that are attached to frames (such as menus and dialog boxes) are not covered.
|
|
Converting AWT to Espresso
This tutorial gives a brief overview of working with AWT and Swing. This is by no means a comprehensive overview of both widget sets, and is restricted to elements used in applets. The reader is encouraged to explore other components of the two widget sets, especially for Swing. As this tutorial is restricted to applets, frames and widgets that are attached to frames (such as menus and dialog boxes) are not covered.
|