import javax.swing.*; import java.awt.*; import java.io.BufferedInputStream; /** * Class that contains the Applet Implementation of the Tide Calendar * * @author Tim Bollman * @author Earthguide * @version 0.5 04-04-05 */ public class TideCalendar extends JApplet { //container that holds whichever JPanel is currently in use. private static Container thisPane; //stores the "Continous View" page of the Tide Calendar private static JPanel continuous; //stores the "Calendar View" page of the Tide Calendar private static JPanel calendar; /**Initializes the applet*/ public void init() { //load the names of the lines into memory Shared.setLines(); //initialize the size of array that stores the two viewable lines Shared.parameterArray = new Parameter[2]; //put La Jolla into the first array. Shared.parameterArray[0] = Grapher.fileReader(Shared.lines[0]); //tell the program that the longest line thus far is La Jolla. Shared.totalDistance = (long)(Shared.parameterArray[0].getTotalDistance()); //set the starting point to be today's date. Shared.offset=(Shared.monthToDay(Shared.currentMonth) + Shared.currentDay - 1) * 24; //init. thisPane thisPane = getContentPane(); //create the two pages continuous = new TideHeight(); calendar = new CalendarFrame(); } /**Called when done initializing, puts the continuous view on the screen*/ public void start() { thisPane.add(continuous); thisPane.validate(); thisPane.repaint(); } /**Does nothing*/ public void stop() { } /**Does nothing*/ public void destroy() { } /**Changes the active page to the Calendar View*/ public static void changeToCalendar() { //this pane wasn't initialized if (thisPane == null) return; thisPane.remove(continuous); thisPane.add(calendar); thisPane.validate(); thisPane.repaint(); } /**Changes the active page to the Continuous View*/ public static void changeToContinuous() { //this pane wasn't initialized if (thisPane == null) return; thisPane.remove(calendar); thisPane.add(continuous); ((TideHeight)continuous).mode1.doClick(); ((TideHeight)continuous).currentMode = Shared.WEEK; thisPane.validate(); thisPane.repaint(); } }