//***************************************************************************** // // Beenish Chaudry, Geetika Tewari, Elif Tosun and // Ileana Streinu // // Summer 1999, Fall 1999, Spring 2000 // //***************************************************************************** // // FramePoint.java // // The "Mother" frame of the applet/application // Contains the CanvasPoint (active) and MenuBarPoint // Generates and controls other frames: // FrameLine(passive canvas) and FrameInfo // FrameColor - for choosing colors // //***************************************************************************** // // called in: AnApplet // //***************************************************************************** import java.awt.*; import java.awt.event.*; import java.lang.*; import java.io.*; import java.applet.*; public class FramePoint extends Frame{ // Model: set of points PointSet ps; //stores the points // auxiliary, for manipulating the point set PointObj crtPt; //stores the current point drawn on the canvas LList selNode; // points to the node containing the current // point selected with the mouse Point displacement; // displacement, when translating points Point p1,p2; // first and second corner of a rectangle for selecting // Views: observers CanvasPoint pc; // main view: points ; active FrameLine lf; // line view: draws dual lines ; passive FrameInfo iw; // information view ; passive ColorFrame cf; // color frame, to edit the colors FrameText ft; // label panel // Control: state of the window-frame State state; MenuBarPoint mb; //main control // Window appearance int width, height; //the dimensions of Bframe; used when resizing with // aspect ratio preservation, as it stores previous size // Applet parent AnApplet ap; //**************************** // // FramePoint constructor // //**************************** public FramePoint(String title, AnApplet app) { super(title); //used to define contructor methods for your own class and to //initialize the variables in a different way state = new State(); ap = app; // model ps = new PointSet(this); crtPt = null; selNode = null; displacement = new Point(0,0); p1 = new Point(0,0); p2 = new Point(0,0); // control mb = new MenuBarPoint(this); setMenuBar(mb); // views pc = new CanvasPoint(this); add(pc); // window setBackground(Constants.backgroundP); setResizable(false); setVisible(true); setBounds(Constants.xFP, Constants.yFP, Constants.wFP, Constants.hFP); width = Constants.wFP; height = Constants.hFP; // activate addWindowListener(new FramePointWindowListener(ap)); addComponentListener(new FramePointComponentListener(this)); }// end constructor FramePoint //**************************** // // Reset FramePoint // // called in MenuBarPoint for New menu option // //**************************** public void Reset() { state.Reset(); setBackground(Constants.backgroundP); // model ps.or = Constants.ctOrigin; ps.unitL.Reset(); ps.wOrient = false; ps.Reset(); ps.DeselectAll(); crtPt = null; selNode = null; displacement.x = displacement.y = 0; // control mb.ResetMenuState(); // views pc.Reset(); lf.lc.Reset(); // window width = Constants.wFP; //intializing the variables height = Constants.hFP; setBounds(Constants.xFP, Constants.yFP, Constants.wFP, Constants.hFP); setResizable(false); repaint(); }// end Reset FramePoint //******************************* // // QuitFrameLine // //******************************* public void QuitFrameLine() { if(lf != null) { lf.dispose(); lf = null; } }//end QuitFrameLine //******************************* // // QuitFrameInfo // //******************************* public void QuitFrameInfo() { if(iw != null) { iw.dispose(); iw = null; } }//end QuitFrameInfo //******************************* // // QuitFrameColor // //******************************* public void QuitFrameColor() { if(cf != null) { cf.dispose(); cf = null; } }//end QuitFrameColor //******************************* // // QuitFrameText // //******************************* public void QuitFrameText() { if(ft != null) { ft.dispose(); ft = null; } }//end QuitFrameText }//end of class FramePoint