All Packages Class Hierarchy This Package Previous Next Index
Class programming101.calculator.CalculatorButton
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Button
|
+----programming101.calculator.CalculatorButton
- public abstract class CalculatorButton
- extends Button
- implements ActionListener
Basic calculator button class.
This class is abstract and cannot be instantiated. It must be subclassed
to implement the following abstract method(s):
actionPerformed
- called when the appropriate
button is pushed
- Since:
- 13/03/98
- Version:
- 1.2 (7/04/98)
- Author:
- © 1998 Peter T. Sander
cumulator-
entryField-
lastButton-
CalculatorButton(String, Calculator)
- Constructor.
actionPerformed(ActionEvent)
- Called when the appropriate button is pushed.
getCalculatorData()
- Getter method for calculator attributes.
getPreferredSize()
- Getter method for button size attributes.
setCalculatorData(double, String, CalculatorButton)
- Setter method for calculator attributes.
setSize(int, int)
- Setter method for button size attributes.
cumulator
protected double cumulator
entryField
protected String entryField
lastButton
protected CalculatorButton lastButton
CalculatorButton
public CalculatorButton(String tag,
Calculator calculator)
- Constructor.
- Parameters:
- tag - button label
getCalculatorData
protected final void getCalculatorData()
- Getter method for calculator attributes. Stores results in appropriate
button object variables.
setCalculatorData
protected final void setCalculatorData(double cumulator,
String entryField,
CalculatorButton lastButton)
- Setter method for calculator attributes. Stores results in appropriate
calculator object variables.
- Parameters:
- cumulator - cumulative value for the calculator
- entryField - last value entered, also value to display
- lastButton - last button pushed
setSize
public final void setSize(int width,
int height)
- Setter method for button size attributes.
- Parameters:
- width - width of button
- height - height of buttn
- Overrides:
- setSize in class Component
getPreferredSize
public final Dimension getPreferredSize()
- Getter method for button size attributes.
- Returns:
- dimensions of the button
- Overrides:
- getPreferredSize in class Component
actionPerformed
public abstract void actionPerformed(ActionEvent ae)
- Called when the appropriate button is pushed.
- Parameters:
- ae - info about button which perpetrated the event
All Packages Class Hierarchy This Package Previous Next Index