/* Project #2 Java Applet to be included in Java Script table Lisa M. Snyder January 25, 1999 Creates the probable bay of a nave wall based on year and width parameters passed by the java script. */ import java.awt.*; import java.awt.event.*; public class bay extends java.applet.Applet implements AdjustmentListener{ int year = 1000; int bay_width = 40; int scale = 2; int number_bays = 3; section Arcade; double a_height; section Triforium; double t_height; section Clerestory; double c_height; int offset = 10; int apph; Scrollbar scrollYear, scrollLength; Label scrollLabel, scrollLabel2; int east_length = 6; Label east[] = new Label[east_length]; //String east[]; String eastlabels[] = {"Number of Bays = ", "Bay Width = ", "Arcade Height = ", "Triforium Height = ", "Clerestory Height = ", "TOTAL HEIGHT = "}; double eastnumbers[] = {(double)(number_bays), (double)(bay_width), a_height/2, t_height/2, c_height/2, (a_height+t_height+c_height)/2}; //Label east[] = new Label[east_length]; //string eastlabels[] = new string[6]; //double eastnumbers[] = new double[6]; // ----------------------------------------------------------------------- public void init() { setBackground (Color.black); apph = size().height; calcHeight(); //calulates and saves section heights //creates the three wall sections Arcade = new section (0,year-1000,bay_width*scale,a_height,offset,apph-offset); Triforium = new section (1,year-1000,bay_width*scale,t_height,offset,(int)(apph-(offset+a_height))); Clerestory = new section (2,year-1000,bay_width*scale,c_height,offset,(int)(apph-(offset+a_height+t_height))); //define layout setLayout(new BorderLayout()); //NORTH PANEL //sets north panel Panel northP = new Panel(); northP.setLayout (new GridLayout(2,2)); northP.setBackground(Color.white); //creates the scrollbar on first row for year scrollLabel = new Label ("Year Built = " + year, Label.CENTER); northP.add(scrollLabel); scrollYear = new Scrollbar(Scrollbar.HORIZONTAL,1000,10,1000,1500); scrollYear.addAdjustmentListener(this); northP.add(scrollYear); //creates the scrollbar on second row for length of nave scrollLabel2 = new Label ("Nave Length = " + (bay_width*number_bays), Label.CENTER); northP.add(scrollLabel2); scrollLength = new Scrollbar(Scrollbar.HORIZONTAL,120,10,80,250); scrollLength.addAdjustmentListener(this); northP.add(scrollLength); add("North",northP); //EAST PANEL //sets east panel Panel eastP = new Panel(); eastP.setLayout (new GridLayout(east_length,1)); eastP.setBackground(Color.gray); //setColor (Color.white); //makes labels for (int i=0; i