/*
Zener.java
This program displays a random Zener card. Zener cards are widely used in
research
in parapsychology (e.g., extra-sensory perception). There are only five
different
card types, called `waves', `cross', `circle', `square' and `star'. Many
experiments hinge on people attempting to guess (or determine by psychic
means!)
which card will be drawn from the pack next.
Anyway, this applet simply displays a random Zener symbol each time it is
started. So the display will be any one of the following images:
<p>
<img src=zenerWaves.gif><img src=zenerCross.gif><img src=zenerCircle.gif> <img
src=zenerSquare.gif><img src=zenerStar.gif>
<p>
(Note that you will only see the images if you are looking at the HTML version
of this
file, Zener.java.html).
<p>
The Zener symbols are stored in GIF (image) files, so the `star'
image is in file `zenerStar.gif', and so on. When this applet executes, it
expects to find the image files in the same directory as the java `.class'
file. If not, it will not work.
<p>
The real purpose of this program is to demonstrate the use of inheritance. In
this
application we have five different cards (wave, square, etc). Each is
represented
as a separate class. All these classes have something in common: the ability to
display an image in a GIF file. The difference between classes is the exact
name
of the file. So we create a class called `Card' which contains the
functionality
needed by every card. Then we create classes called `Wave', `Square', etc.,
which implement what is different about each card. It turns out that the
classes that implement the individual classes are very simple; most of the
work is done in the Card class.
Note also that this program is very long for what it does; there are much
simpler
ways to do the same job!
Kevin Boone, August 1999
*/
import java.applet.Applet;
import java.net.URL;
import java.awt.*;
/*
class Zener
This class is an Applet. Whenever it is re-drawn (that is, its `paint()'
operation
called), it creates a new object of one of the Card subclasses, and calls its
`draw()' operation.
*/
public class Zener extends Applet