day 20




the java cup is half full 2: an applet a day


The Java craze is just one of several crazes

which are a part of the daily Internet hysteria.

"Plug-ins" and "agents" are others, and I will

have more to say about them in later Daily

Doses. The thrust of the Java craze is the

so-called applet. An applet is a handler that

responds to some event created by the user when

viewing an HTML document through a browser like

Navigator. Typical events are a press of a keyboard,

a mouse click on a region of the screen, or a

change in a variable.

Here is how a Java applet works. A skeletal

structure called AWT (Another Windowing Toolkit,

or Abstract Windowing Toolkit) hiding underneath

the Navigator browser intercepts all user

interactions. That is, AWT catches mouse-down

events, keyboard events, etc., and passes them

on to a handler. Each handler carries out the

desired work. One handler might animate a

bouncing ball, another might wait for the user

to enter text into a field in a form, and yet

another might generate a sound when the user

clicks on a GUI button. Handlers are simply

procedures that are called whenever needed.

Suppose the AWT intercepts an event and then

passes control to the appropriate event handler.

Further suppose the handler is written in Java.

Lets take this one step further. Suppose Java

procedures for all handlers are embedded in the

HTML-formatted document being viewed by a

browser. The event passes to the AWT code, then

the event handler, and finally to the Java code

that implements the appropriate action. When the

Java code executes, the bouncing ball bounces,

and the animation animates. This is the idea of

an applet.

It is not necessary to write all applets in

Java. Only the public relations department of

JavaSoft thinks that all applets must be written

in Java. In fact, the Java vultures are waiting

in the wings - when Java slips, they plan to

swoop down and pick its bones. Tomorrow we

expose these carrion eaters for what they are.

the java cup is half full: 1 2 3 4 5



Daily Dose Index