* * This class is a pretty generic button handler; it doesn't do * anything. Its subclasses should override handleButton() to make it * do something interesting. The fields of this class are protected * (rather than private) precisely to allow access in these overridden * methods.
* * Each ButtonObj knows about the Calculator (or at any rate a text * interface to the Calculator) and its state.
* * It might be reasonable to declare this class abstract. * * @author: Lynn Andrea Stein, las@ai.mit.edu * @version: $$ * @see Calculator, CalcTextGUI, CalculatorState, ButtonHandler */ public class ButtonObj { /** * The Calculator-adaptor that this instance can use to get and * set text. Initialized in constructor; shouldn't change. */ protected CalcTextGUI gui; /** * The CalculatorState that keeps track of what's going on in the * behavior of the Calculator that this ButtonObj belongs to. * Initialized in constructor; shouldn't change. */ protected CalculatorState stateObj; /** * How to make one: tell it what GUI and what state object it's * working with. It will remember these for future use. * * @param gui The CalcTextGUI to keep track of. * @param stateObj The CalculatorState to keep track of. */ public ButtonObj( CalcTextGUI gui, CalculatorState stateObj ) { this.gui = gui; this.stateObj = stateObj; } /** * How to handle a button. (In this case, don't do much. * Subclasses will override.) */ public void handleButton(){} } /* * $Log: ButtonObj.java,v $ * Revision 1.1.1.1 2002/06/05 21:56:25 root * CS101 comes to Olin finally. * * Revision 1.3 1997/10/30 03:28:35 lfgs * Added overview and fixed "* /" commenting typo in code. * * Revision 1.2 1997/10/24 22:20:41 las * Documented all of the code files, but didn't write the user manual (yet). * */