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
extends java.awt.Button
in order to be a visible bean
implements java.awt.event.ActionListener
guarantees code for the actionPerformed
method which is invoked by button events
implments FR.essi.sander.graphix.mvc.Control
guarantees code implementing management for ControlListener
s
This class is abstract and cannot be instantiated. It must be subclassed
to implement the following abstract method(s):
op
- the method specific to each button
- Since:
- 18/03/98
- Version:
- 1.3 (6/04/98)
- Author:
- © 1998 Peter T. Sander
- See Also:
- FR.essi.sander.graphix.mvc.ControlImpl
CalculatorButton()
- No-args constructor (needed for JavaBeans).
actionPerformed(ActionEvent)
- Method guaranteed by implementing the
ActionListener
interface.
addControlListener(ControlListener)
- Registers another listener to be informed when a button is clicked.
fireControlEvent(ControlEvent)
- Fires a button event to registered listeners.
getPreferredSize()
- Getter method for button size attributes.
op(double, double, CalculatorButton)
- The method specific to each button.
removeControlListener(ControlListener)
- Removes a listener.
setSize(int, int)
- Setter method for button size attributes.
CalculatorButton
public CalculatorButton()
- No-args constructor (needed for JavaBeans).
Registers itself as a listener for button events.
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
removeControlListener
public void removeControlListener(ControlListener listener)
- Removes a listener.
The actual management is delegated to the
ControlImpl
object.
- Parameters:
- listener - listener to remove
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
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
getPreferredSize
public Dimension getPreferredSize()
- Getter method for button size attributes.
- Returns:
- dimensions of the button
- Overrides:
- getPreferredSize in class Component
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
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