JavaCalc
Description
This applet is an AWT-based calculator which demonstrates the two key facets of the Advanced
Windowing Toolkit: user-interface controls and layout managers.
Implementation
In particular, the calculator applet uses three user-interface "controls": the text-field (as a
readout), the label (as a spacer between the readout and the keypad), and buttons
(for the keypad).
It also uses three different layout managers: GridLayout, for the keypad,
BorderLayout, to arrange the readout and the keypad, and FlowLayout, to place all of
the elements within the frame.
Functionality
The calculator, itself, implements only the four basic functions and a one-number memory. It
is, of course, infinitely extendable, but adding functionality would be more of an
exercise
in generic programming than it would be a demonstration of AWT programming.
Source Code
Calc1.java -- the main applet file, which creates a new frame and drops our
calculator into it.
KeyPad1.java -- class definition which defines the layout and functionality
of our calculator.