Practice exercise -- Calculator

This is another practice exercise using Swing components, layouts, and event handling. Note that this came from an assignment from a good while back, because this specification references Windows XP further down. :-)

Task

First, build the GUI layout for a calculator, so that it looks like this:

Note that this calculator has not only the buttons, but also a text field at the very top, where the numbers display when calculator buttons are pressed.

Adding functionality to this layout

Events to handle

Functionality

The idea is to make this work like a real calculator would, for the simple arithmetic calculations (addition, subtraction, multiplication, division). Some things to remember: