Application Development |
This appendix contains the development notes for the Panther Java Calculator sample that is located at $SMBASE/samples/javacal
c.
Repository Contents |
The repository, calc.dic
, contains the following items.
Calculator Screen |
The calculator screen, calc.scr
, contains the following widgets and settings.
The following table lists the types of push buttons, their names, the push button they inherit from in the repository and the java class.
Java Classes |
The Java classes have been broken into handlers which handle either screen entry or "classes" of buttons. This is a mid-way point between having a separate class for each button and having a single class handle all the buttons.
CalcScreen
:
Screen entry function. Initialize global variables and allow backspace, delete and Newline to be caught by ButtonHandler.
Screen exit function. Release backspace, delete, and Newline, restoring normal behavior for those keys.
CalcFunc1
:
Handles all single operand calculator functions (like Sqrt functions). Also handles the Sign toggle (+/-)
CalcFunc2
:
Handles all dual operand calculator functions. This class actually performs the last stored operation, and stores the next operation in the global variable "operation."
CalcMem
:
Handles all memory functions.
CalcMisc
:
Handles C, CE, backspace and Pi button.
CalcMode
:
Handle mode switching buttons, "Deg/Rad" and "#/$"
CalcTrig
:
Even though these functions are similar to the CalcFunc1 operations, these make use of the "degrees" setting, so a separate class was created.
CalcNum
:
Handles all numeric keys, and period.