/*----------------------------------------------------------------------+ | Title: RangeDisplay.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.*; import java.awt.event.*; public class RangeDisplay extends Canvas { Color background; // background color for the window Range R; // the range being displayed //display data double x[], y[]; // the (x,y) coordinates for the center of the herd double s_rad, t_rad; // relative radii of circles RangeDisplay (Range R_init, Color bg_init) { R = R_init; R.display = this; background = bg_init; resetRangeDisplay(); addMouseListener(new MouseClickListener()); } void resetRangeDisplay() { // compute some display constants x = new double[R.n_herds]; y = new double[R.n_herds]; if (R.n_herds == 1) { // special computations when one herd x[0] = 0.0; y[0] = 0.0; s_rad = 0.0; t_rad = 1.0; } else { // more than one herd double theta = 2*Math.PI/R.n_herds; for (int i=0; i