All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sim.display.Graph2D

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----GWin
                                   |
                                   +----Display
                                           |
                                           +----sim.display.Graph2D

public class Graph2D
extends Display
This Display maintains a square window which contains a Plot or multiple Plots. The user can zoom in and reset with the mouse and menu. The refresh rate of redrawing can be different from the rate at which the Plot samples and stores data. The entire Display can be forced to redraw by clicking on it.

This code is (c) 1996,1997 Leemon Baird <leemon@cs.cmu.edu>, http://www.cs.cmu.edu/~baird
The source and object code may be redistributed freely. If the code is modified, please state so in the comments.

Version:
1.01 2 June 97
Author:
Leemon Baird

Variable Index

 o origMaxX
Max value of x to plot originally (menu item "top level" returns to this)
 o origMaxY
Max value of y to plot originally (menu item "top level" returns to this)
 o origMinX
Min value of x to plot originally (menu item "top level" returns to this)
 o origMinY
Min value of y to plot originally (menu item "top level" returns to this)
 o trigger
Variable whose changes trigger updates of the graph
 o triggerFreq
How many times the trigger variable must change to cause an update
 o triggerVar

Constructor Index

 o Graph2D()

Method Index

 o action(Event, Object)
respond to the menu choices
 o addMenus(MenuBar)
add menu items to the window containing this GWin canvas.
 o destroy()
ensure the function approximator has its destroy() called too
 o drawAll(Graphics)
Override this to draw directly to the display.
 o getParameters(int)
Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
 o initialize(int)
Initialize, either partially or completely.
 o mouseDown(Event, int, int)
function mouseDown Event Handling for pressing mouseButton
 o mouseDrag(Event, int, int)
mouseDrag Event Handling for dragging Mouse
 o mouseUp(Event, int, int)
funtion mouseUp Event Handling for releasing mouseButton
 o setWatchManager(WatchManager, String)
Remember the WatchManager for this object and create the window.
 o update(String, Pointer, Watchable)
The variable changed, so redraw

Variables

 o origMinX
 protected NumExp origMinX
Min value of x to plot originally (menu item "top level" returns to this)

 o origMaxX
 protected NumExp origMaxX
Max value of x to plot originally (menu item "top level" returns to this)

 o origMinY
 protected NumExp origMinY
Min value of y to plot originally (menu item "top level" returns to this)

 o origMaxY
 protected NumExp origMaxY
Max value of y to plot originally (menu item "top level" returns to this)

 o trigger
 protected PString trigger
Variable whose changes trigger updates of the graph

 o triggerFreq
 protected IntExp triggerFreq
How many times the trigger variable must change to cause an update

 o triggerVar
 protected Pointer triggerVar

Constructors

 o Graph2D
 public Graph2D()

Methods

 o getParameters
 public Object[][] getParameters(int lang)
Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.

Overrides:
getParameters in class Display
See Also:
getParameters
 o addMenus
 public void addMenus(MenuBar mb)
add menu items to the window containing this GWin canvas.

Overrides:
addMenus in class GWin
 o action
 public boolean action(Event e,
                       Object w)
respond to the menu choices

Overrides:
action in class Component
 o setWatchManager
 public void setWatchManager(WatchManager wm,
                             String name)
Remember the WatchManager for this object and create the window. After everything is parsed and windows are created, all experiments are given a watchManager by Simulator, then it starts giving each Display a watchManager. This is where the Display should register each variable it wants to watch.

Overrides:
setWatchManager in class Display
 o update
 public void update(String changedName,
                    Pointer changedVar,
                    Watchable obj)
The variable changed, so redraw

Overrides:
update in class Display
 o mouseDown
 public boolean mouseDown(Event e,
                          int x,
                          int y)
function mouseDown Event Handling for pressing mouseButton

Overrides:
mouseDown in class Component
 o mouseDrag
 public boolean mouseDrag(Event e,
                          int x,
                          int y)
mouseDrag Event Handling for dragging Mouse

Overrides:
mouseDrag in class Component
 o mouseUp
 public boolean mouseUp(Event e,
                        int x,
                        int y)
funtion mouseUp Event Handling for releasing mouseButton

Overrides:
mouseUp in class Component
 o destroy
 public void destroy()
ensure the function approximator has its destroy() called too

Overrides:
destroy in class Display
 o drawAll
 public void drawAll(Graphics g)
Override this to draw directly to the display.

Overrides:
drawAll in class Display
 o initialize
 public void initialize(int level)
Initialize, either partially or completely.

Overrides:
initialize in class Display
See Also:
initialize

All Packages  Class Hierarchy  This Package  Previous  Next  Index