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):

Since:
13/03/98
Version:
1.2 (7/04/98)
Author:
© 1998 Peter T. Sander

Variable Index

 o cumulator
 o entryField
 o lastButton

Constructor Index

 o CalculatorButton(String, Calculator)
Constructor.

Method Index

 o actionPerformed(ActionEvent)
Called when the appropriate button is pushed.
 o getCalculatorData()
Getter method for calculator attributes.
 o getPreferredSize()
Getter method for button size attributes.
 o setCalculatorData(double, String, CalculatorButton)
Setter method for calculator attributes.
 o setSize(int, int)
Setter method for button size attributes.

Variables

 o cumulator
protected double cumulator
 o entryField
protected String entryField
 o lastButton
protected CalculatorButton lastButton

Constructors

 o CalculatorButton
public CalculatorButton(String tag,
                        Calculator calculator)
Constructor.

Parameters:
tag - button label

Methods

 o getCalculatorData
protected final void getCalculatorData()
Getter method for calculator attributes. Stores results in appropriate button object variables.

 o 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
 o 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
 o getPreferredSize
public final Dimension getPreferredSize()
Getter method for button size attributes.

Returns:
dimensions of the button
Overrides:
getPreferredSize in class Component
 o 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