All Packages Class Hierarchy This Package Previous Next Index
Class Calculator.DotButtonObj
java.lang.Object
|
+----Calculator.ButtonObj
|
+----Calculator.DotButtonObj
- public class DotButtonObj
- extends ButtonObj
This class is a smart button object that handles the Calculator's decimal
point. Every ButtonHandler should have one.
- See Also:
- Calculator
-
DotButtonObj(ButtonObj,
CalcTextGUI, CalculatorState)
- How to make one: Make a ButtonObj (i.e., my superclass) and also
remember that zero button.
-
handleButton()
- This method is called by the ButtonHandler whenever the decimal point
button is pressed.
DotButtonObj
public DotButtonObj(ButtonObj zeroButton,
CalcTextGUI gui,
CalculatorState stateObj)
- How to make one: Make a ButtonObj (i.e., my superclass) and also
remember that zero button.
- Parameters:
- zeroButton - The zero ButtonObj for this calculator.
- 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? If we're already reading a
number, add the decimal point to the text and have the state remember.
If we're not reading a number (e.g., we just saw an operation), pretend
that the 0 was pressed first.
- Overrides:
- handleButton
in class ButtonObj
All Packages Class Hierarchy This Package Previous Next Index