All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----edu.cornell.lassp.mck10.Hysteresis.LatticeView
LatticeView is a class which can be used for viewing the
state of a hysteresis lattice. It can display lattices in any number
of dimensions two or greater. For dimensions greater than two, the
higher dimensions are shown with color. The display is as if the
viewer is looking through the lattice, and the more spins are up, the
closer a pixel gets to white. The more spins are down, the closer it
gets to black. Colors are used to display individual avalanches. When
an avalanche first flips, the previous avalanche is erased, and the new
avalanche is displayed. The colors of the avalanche represent the order
in which the spins flipped. Blue represents spins that flipped early,
then green, yellow, orange, red, and finally purple.
Source Code is available.
localMenu contains the configuration menu for the
lattice view.
LatticeView(model,menu) constructor is used to
create a new LatticeView displaying the model
model and attaching its menu to the menu menu
clearAvalanche() is used to erase the last avalanche
from the display.
drawAvalanche() displays the last avalanche.
minimumSize() returns the minimum size for the view.
notify(avalanche,prod) is called any time an avalanche
is produced.
paint is called whenever the display area needs to be
repainted.
preferredSize() returns the preferred size of the view.
resize(newSize) is overridden so that the display will
be re-setup when the area is resized.
restart() is called when we want to reset the view.
update is called when one of the configurable parameters
of the model has changed.
update(g) is overridded so that the display will not be
blanked before it is redrawn.
public ConfigurableCollection localMenu
localMenu contains the configuration menu for the
lattice view.
public LatticeView(HysteresisLattice model,
ConfigurableCollection menu)
LatticeView(model,menu) constructor is used to
create a new LatticeView displaying the model
model and attaching its menu to the menu menu
public void update(Observable obs,
Object obj)
update is called when one of the configurable parameters
of the model has changed. When this happens, we probably need to
change the way we display ourselves, or at the very least clear
the display.
public void update(Graphics g)
update(g) is overridded so that the display will not be
blanked before it is redrawn.
public void resize(Dimension newSize)
resize(newSize) is overridden so that the display will
be re-setup when the area is resized.
public void paint(Graphics g)
paint is called whenever the display area needs to be
repainted. This paint method sets things up properly if they haven't
been set up already, and draws myImage to the screen
if it has been drawn to.
public void notify(Avalanche avalanche,
AvalancheProducer prod)
notify(avalanche,prod) is called any time an avalanche
is produced. This is where the avalanches are displayed.
public void clearAvalanche()
clearAvalanche() is used to erase the last avalanche
from the display. Instead, we see the normal view through the
lattice.
public void drawAvalanche()
drawAvalanche() displays the last avalanche.
public Dimension preferredSize()
preferredSize() returns the preferred size of the view.
This should be big enough to hold a model of the current dimensions
with spins displayed large enough to make the display area at least
150 pixels.
public Dimension minimumSize()
minimumSize() returns the minimum size for the view.
This should be big enough to hold a model of the current dimensions
with spins taking up one pixel.
public void restart()
restart() is called when we want to reset the view.
All Packages Class Hierarchy This Package Previous Next Index