The ObjectAda(tm) Desktop Calculator

If you are using the Internet Explorer 3.01 or Netscape 2.0 browsers you can see a calculator in a separate window.

ObjectAda(tm) supports Microsoft and JavaSoft virtual machine technology. The Microsoft Virtual Machine for Java is available with the Internet Explorer 3.01 which can be installed via the browser selection page in the ObjectAda for Windows installation wizard. There is an option to install the JavaSoft Java Development Kit at the end of the ObjectAda for Windows installation wizard.

The calculator is organized as follows:

  • A Calculator Engine provides GUI-independent calculator functionality. It takes input at the button press level, and returns strings representing new values for the display.

    The engine is implemented as a generic package. The package has a single formal parameter which is a subprogram to be called whenever the display changes.

    It takes advantage of the Ada.Strings.Unbounded package to do its string manipulation. An new implementation of this package was done for AppletMagic(tm); it is based on the Java StringBuffer type.

  • The user interface is provided by the bigCalc package. This creates an applet object so that it can be embedded in web pages, but it mainly uses the AWT toolkit. This instantiates the Calculator Engine to do the calculating. Most of the work here is in constructing the various components of the user interface.

  • To make using the AWT interface from Ada more convenient, there are a couple of AWT utility packages.
  • Ind_Frame is a subclass of the AWT Frame class which disposes the window rather than causing the application to exit when the window is deleted.
  • nonLayout is a class supporting a kind of window layout that doesn't actually do anything--things stay where you put them. (A notable omission from the AWT!)
  • typeablePanel is a generic package for a subclass of the AWT Window type that lets you handle keystrokes through a callback procedure given as a generic parameter.
  • cbButton is a generic package for a subclass of the Button type which allows you to specify a callback procedure as a generic parameter. This one also lets you pass your own per-button information to the callback procedure.

  • While the AppletMagic(tm) run-time system is still under construction, the calculator uses a package called Image to convert integer and floating point values to strings. This package also makes use of the Ada.Strings.Unbounded package.