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

Class edu.cornell.lassp.mck10.HysteresisApplet.LoopButton

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

public class LoopButton
extends Button
implements Runnable, Observer
LoopButton produces a button which can be used to generate an entire hysteresis loop with the press of a single button.

Source Code is available.

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

Constructor Index

 o LoopButton(HysteresisLattice, AutoFitButton, String)
The LoopButton(model,fit,name) attatches the button to the model, and the fit button which is used for zooming, and gives the button a label given by the parameter name

Method Index

 o action(Event, Object)
action(e,o) is called every time the button is pressed.
 o makeLoop()
makeLoop() is called to generate a new hysteresis loop.
 o run()
run() is called when makeLoop() spawns a new thread.
 o update(Observable, Object)
update(o,obj) is called whenever one of the parameters of the model is changed.

Constructors

 o LoopButton
  public LoopButton(HysteresisLattice model,
                    AutoFitButton fit,
                    String name)
The LoopButton(model,fit,name) attatches the button to the model, and the fit button which is used for zooming, and gives the button a label given by the parameter name
Parameters:
model - The model which will generate the loop.
fit - The button which will be used for zooming.
name - The label for the button.

Methods

 o action
  public boolean action(Event e,
                        Object o)
action(e,o) is called every time the button is pressed. when this happens, makeLoop() is called to generate a new hysteresis loop.
Parameters:
e - The event.
o - An unused parameter.
Overrides:
action in class Component
 o update
  public void update(Observable o,
                     Object obj)
update(o,obj) is called whenever one of the parameters of the model is changed. If this happens, there is a new simulation, and we should stop trying to generate the hysteresis loop.
Parameters:
o - The observable which has changed.
obj - An unused parameter.
 o makeLoop
  public void makeLoop()
makeLoop() is called to generate a new hysteresis loop. It stops the model if it is running, then it spawns a new thread in which the hysteresis loop is generated.
 o run
  public void run()
run() is called when makeLoop() spawns a new thread. It just tells the model to increase to the maximum field, waits for it to finish, then tells it to decrease to the minimum field. If running becomes false, it stops generating the hysteresis loop, because the parameters of the model have changed. After the loop is generated, the fit button is used to zoom in on the loop.

All Packages  Class Hierarchy  This Package  Previous  Next  Index