/*----------------------------------------------------------------------+ | Title: Herd.java | | | | Author: David E. Joyce | | Department of Mathematics and Computer Science | | Clark University | | Worcester, MA 01610-1477 | | U.S.A. | | | | http://aleph0.clarku.edu/~djoyce/home.html | | djoyce@clarku.edu | | | | Date: February, 2001. | +----------------------------------------------------------------------*/ import java.awt.*; public class TimeGraph extends Canvas { int n; // the number of data points, also the width of the Canvas int point; // the oldest data point Color background; // the color for the background of the graph int a[],b[],c[]; // the three quantities being displayed Color aColor[],bColor[],cColor[]; // the colors associated to them TimeGraph (int init_n, Color bg_init) { n = init_n; background = bg_init; a = new int[n]; b = new int[n]; c = new int[n]; aColor = new Color[n]; bColor = new Color[n]; cColor = new Color[n]; point = 0; } void clear() { for (int i=0; i max) max = sum; } // next, paint lines for (int i=0; i