All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Calculator.ButtonHandler

java.lang.Object
   |
   +----Calculator.ButtonHandler

public class ButtonHandler
extends Object
implements Runnable
This class is the "smarts" for a Calculator. There should be one for each Calculator. Creating it sets up all of the other infrastructure required to handle button presses; it is an interactive control loop and runs asynchronously with the Calculator GUI.

The heart of a ButtonHandler instance is an interactive control loop that operates in an object-oriented polymorphic-dispatch mode: that is, each button pressed is associated with an intelligent ButtonObj(ect), and that button object is asked to handle itself. There's also a single calculator state object that each of the button objects can use.

See Also:
Calculator

Constructor Index

 o ButtonHandler(Calculator)
This constructor sets up a button handler control loop and the myriad objects that will actually do the work.

Method Index

 o run()
Called by the ButtonHandler's Thread, this is how this object behaves on an ongoing/independent basis.

Constructors

 o ButtonHandler
 public ButtonHandler(Calculator realGUI)
This constructor sets up a button handler control loop and the myriad objects that will actually do the work.

Parameters:
realGUI - The Calculator whose button presses this object is handling.

Methods

 o run
 public void run()
Called by the ButtonHandler's Thread, this is how this object behaves on an ongoing/independent basis. Gets a button, handles it, repeat.

How to handle a button? Ask the associated "smart object" to handle itself! (Typical middle management :o) ).


All Packages  Class Hierarchy  This Package  Previous  Next  Index