/* * ClearButtonObj Class * * Developed for "Rethinking CS101", a project of Lynn Andrea Stein's AP Group. * For more information, see the * CS101 homepage or email . * * Copyright (C) 1997 Massachusetts Institute of Technology. * Please do not redistribute without obtaining permission. */ package Calculator; /** * This class is a smart button object that clears the Calculator. * Every ButtonHandler should have one. * * @author: Luis F. G. Sarmenta, lfgs@mit.edu * @version: $$ * * @see Calculator, ButtonHandler, ButtonObj */ public class ClearButtonObj extends ButtonObj { /** * How to make one: Make a ButtonObj (i.e., my superclass). This * constructor exists only to call super w/the appropriate * arguments. * * @param gui The CalcTextGUI to keep track of. * @param stateObj The CalculatorState to keep track of. */ public ClearButtonObj( CalcTextGUI gui, CalculatorState stateObj ) { super( gui, stateObj ); } /** * This method is called by the ButtonHandler whenever the * decimal point button is pressed.

* * How to handle (my button) being pressed? Clear the calculator * by asking its state to reset.

* * This should really call this.gui.clearScreen(), now, shouldn't it? */ public void handleButton() { this.stateObj.reset(); this.gui.setText(""); } } /* * $Log: ClearButtonObj.java,v $ * Revision 1.1.1.1 2002/06/05 21:56:25 root * CS101 comes to Olin finally. * * Revision 1.2 1997/10/24 22:20:41 las * Documented all of the code files, but didn't write the user manual (yet). * */