All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class programming101.calculBeanz.CalculatorButton

java.lang.Object
    |
    +----java.awt.Component
            |
            +----java.awt.Button
                    |
                    +----programming101.calculBeanz.CalculatorButton

public abstract class CalculatorButton
extends Button
implements ActionListener, Control
Basic calculator button class. This is the C-component in the Model-View-Control (MVC) design pattern. This class This class is abstract and cannot be instantiated. It must be subclassed to implement the following abstract method(s):

Since:
18/03/98
Version:
1.3 (6/04/98)
Author:
© 1998 Peter T. Sander
See Also:
FR.essi.sander.graphix.mvc.ControlImpl

Constructor Index

 o CalculatorButton()
No-args constructor (needed for JavaBeans).

Method Index

 o actionPerformed(ActionEvent)
Method guaranteed by implementing the ActionListener interface.
 o addControlListener(ControlListener)
Registers another listener to be informed when a button is clicked.
 o fireControlEvent(ControlEvent)
Fires a button event to registered listeners.
 o getPreferredSize()
Getter method for button size attributes.
 o op(double, double, CalculatorButton)
The method specific to each button.
 o removeControlListener(ControlListener)
Removes a listener.
 o setSize(int, int)
Setter method for button size attributes.

Constructors

 o CalculatorButton
public CalculatorButton()
No-args constructor (needed for JavaBeans). Registers itself as a listener for button events.

Methods

 o addControlListener
public void addControlListener(ControlListener listener)
Registers another listener to be informed when a button is clicked. The actual management is delegated to the ControlImpl object.

Parameters:
listener - listener to add
 o removeControlListener
public void removeControlListener(ControlListener listener)
Removes a listener. The actual management is delegated to the ControlImpl object.

Parameters:
listener - listener to remove
 o fireControlEvent
public void fireControlEvent(ControlEvent ce)
Fires a button event to registered listeners. The actual management is delegated to the ControlImpl object.

Parameters:
be - button event encapsulating relevant button information
 o setSize
public 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 Dimension getPreferredSize()
Getter method for button size attributes.

Returns:
dimensions of the button
Overrides:
getPreferredSize in class Component
 o op
public abstract double op(double cumul,
                          double entry,
                          CalculatorButton lastButton)
The method specific to each button.

Parameters:
cumul - the current cumulator value
entry - the newly-entered value
lastButton - the button clicked before this one
Returns:
new cumulator value
 o actionPerformed
public void actionPerformed(ActionEvent ae)
Method guaranteed by implementing the ActionListener interface. Invoked by the underlying windowing system to handle button click events.

Parameters:
ae - action event fired by the windowing system

All Packages  Class Hierarchy  This Package  Previous  Next  Index