All Packages Class Hierarchy This Package Previous Next Index
Class Calculator.NumButtonObj
java.lang.Object
|
+----Calculator.ButtonObj
|
+----Calculator.NumButtonObj
- public class NumButtonObj
- extends ButtonObj
This class is a smart button object that handles the Calculator's numeric
buttons. Every ButtonHandler should have ten ( 0 - 9 ).
- See Also:
- Calculator
-
NumButtonObj(int,
CalcTextGUI, CalculatorState)
- How to make one: Make a ButtonObj (i.e., my superclass) and also
remember my number.
-
handleButton()
- This method is called by the ButtonHandler whenever the decimal point
button is pressed.
NumButtonObj
public NumButtonObj(int num,
CalcTextGUI gui,
CalculatorState stateObj)
- How to make one: Make a ButtonObj (i.e., my superclass) and also
remember my number.
- Parameters:
- num - Which numbered button am I? ( 0 - 9 )
- gui - The CalcTextGUI to keep track of.
- stateObj - The CalculatorState to keep track of.
handleButton
public void handleButton()
- This method is called by the ButtonHandler whenever the decimal point
button is pressed.
How to handle (my button) being pressed? Make sure that we're
reading a number (tell the stateObj if it doesn't know) and then either
use this number as the current display or append it to it if there's
already a partial number.
- Overrides:
- handleButton
in class ButtonObj
All Packages Class Hierarchy This Package Previous Next Index