Class edu.cornell.lassp.mck10.HysteresisApplet.AutoFitButton
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class edu.cornell.lassp.mck10.HysteresisApplet.AutoFitButton

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Button
                   |
                   +----edu.cornell.lassp.mck10.HysteresisApplet.AutoFitButton

public class AutoFitButton
extends Button
implements Observer, XYConsumer
AutoFitButton is used in conjunction with the LoopView class to zoom the view to exactly the size of the hysteresis loop.

Source Code is available.

Version:
1.0
Author:
Matt Kuntz (e-mail: mck10@cornell.edu)

Constructor Index

 o AutoFitButton(HysteresisLattice, LoopView, String)
the AutoFitButton(model,loop,name) constructor is used to create a new button attatched to a particular model and view, with the label given in the String name.

Method Index

 o action(Event, Object)
action(e,o) is called when the button is pressed.
 o fit()
fit() can be called from outside the class to zoom in on the hysteresis loop without the user pressing the button.
 o notify(XYPair, XYProducer)
notify(XY,prod) is called when there is a new point in the hysteresis loop.
 o update(Observable, Object)
update(obs,obj) is called whenever the parameters of the simulation are changed.

Constructors

 o AutoFitButton
  public AutoFitButton(HysteresisLattice model,
                       LoopView loop,
                       String name)
the AutoFitButton(model,loop,name) constructor is used to create a new button attatched to a particular model and view, with the label given in the String name.
Parameters:
model - The model we are displaying.
loop - The view we are zooming in on.
name - The label for the button.

Methods

 o action
  public boolean action(Event e,
                        Object o)
action(e,o) is called when the button is pressed. When this happens, we want to zoom in to the present size of the hysteresis loop.
Parameters:
e - The event that has occurred.
o - An unused parameter.
Overrides:
action in class Component
 o notify
  public void notify(XYPair XY,
                     XYProducer prod)
notify(XY,prod) is called when there is a new point in the hysteresis loop. We need to check to see if the new point changes the size of the hysteresis loop.
Parameters:
XY - The new point on the hysteresis loop.
prod - The model which produced the point.
 o update
  public void update(Observable obs,
                     Object obj)
update(obs,obj) is called whenever the parameters of the simulation are changed. If this happens, there is a new hysteresis loop, and we need to change all of our parameters.
Parameters:
obs - The observable variable which has changed.
obj - An unused parameter.
 o fit
  public void fit()
fit() can be called from outside the class to zoom in on the hysteresis loop without the user pressing the button. This is used to zoom in after a hysteresis loop has been automatically generated.

All Packages  Class Hierarchy  This Package  Previous  Next  Index