package NGPdemos; /** * Example1eApp.java * * * Created: Thu Feb 15 16:27:53 2001 * * @author Brown U. lecture notes modified by Stuart C. Shapiro */ public class Example1eApp extends NGP.Containers.Frame{ private NGP.Containers.Column _column; private NGP.Containers.DrawingPanel _drawingPanel; private NGP.Graphics.FilledRectangularShape _face, _ltEye, _rtEye; private NGP.Graphics.Text _text; private NGP.Components.QuitButton _quitButton; public Example1eApp (){ super("NGP Rocks!"); //instantiate the column. _column = new NGP.Containers.Column(this); // instantiate and set properties of drawing panel _drawingPanel = new NGP.Containers.DrawingPanel(_column); // numbers gotten by trial & error _drawingPanel.setDimension(new java.awt.Dimension(320,353)); _drawingPanel.setColor(java.awt.Color.white); // initiate face parts _face = new NGP.Graphics.FilledEllipse(_drawingPanel); _ltEye = new NGP.Graphics.FilledEllipse(_drawingPanel); _rtEye = new NGP.Graphics.FilledEllipse(_drawingPanel); // finally set properties of face parts // (Meta-Slash in Emacs is my friend!) _face.setLocation(new java.awt.Point(100,100)); _ltEye.setLocation(new java.awt.Point(133,120)); _rtEye.setLocation(new java.awt.Point(164,120)); _face.setDimension(new java.awt.Dimension(120,153)); _ltEye.setDimension(new java.awt.Dimension(20,50)); _rtEye.setDimension(new java.awt.Dimension(20,50)); _face.setColor(java.awt.Color.green); _ltEye.setColor(java.awt.Color.black); _rtEye.setColor(java.awt.Color.black); /* now, instantiate Text with its container and the String to display */ _text = new NGP.Graphics.Text(_drawingPanel, "Take me to your leader!"); _text.setColor(java.awt.Color.blue); //text location is from lower left-hand corner _text.setLocation(new java.awt.Point(90,275)); //install quit button _quitButton = new NGP.Components.QuitButton(_column, "Quit"); } public static void main (String[] args) { Example1eApp app = new Example1eApp(); app.setDimension(new java.awt.Dimension(400,450)); app.show(); } // end of main () }// Example1eApp