001    /*
002     * cs101 SimpleFrame
003     * $Id: SimpleFrame.java,v 1.1.1.1 2002/06/05 21:56:36 root Exp $
004     *
005     * Developed for "Rethinking CS101", a project of Lynn Andrea Stein's AP Group.
006     * For more information, see <a href="http://www.ai.mit.edu/projects/cs101/">the
007     * CS101 homepage</a> or email <las@ai.mit.edu>.
008     *
009     * Copyright (C) 1996 Massachusetts Institute of Technology.
010     * Please do not redistribute without obtaining permission.
011     */
012    
013    package stringtransformers;
014    
015    import java.awt.*;
016    import java.awt.event.*;
017    
018    /** 
019     * Simple top level that deals with one component and sizing.
020     * Based on cs101.awt.DefaultFrame.java version 1.6
021     *
022     * <P>Copyright (c) 1999 Massachusetts Institute of Technology
023     *
024     * @author Lynn Andrea Stein, las@ai.mit.edu
025     * @author Todd C. Parnell, tparnell@ai.mit.edu
026     * @author <nathanw@mit.edu>
027     * @version $Id: SimpleFrame.java,v 1.1.1.1 2002/06/05 21:56:36 root Exp $
028     */
029    public class SimpleFrame extends Frame {
030      /** The Component to display. */
031      protected Component c;
032      
033      /** 
034       * Initilize the frame and set up a listener for windowClosing events.
035       * Does not show the frame.  To show the frame, use init().
036       *
037       * @see #init
038       *
039       * @param     c       Component to display.
040       */
041      public SimpleFrame(Component c) {
042        super("Default");
043        this.c=c;
044    
045        this.addWindowListener(new WindowAdapter() {
046          public void windowClosing(WindowEvent e) {
047            SimpleFrame.this.dispose();
048            System.exit(0);
049          }
050        });
051      }
052    
053      /**
054       * Make the frame appear 
055       */
056      public void init() {
057        this.add("Center",c);
058        this.pack();
059        this.show();
060      }
061    }
062    
063    /*
064     * $Log: SimpleFrame.java,v $
065     * Revision 1.1.1.1  2002/06/05 21:56:36  root
066     * CS101 comes to Olin finally.
067     *
068     * Revision 1.2  2000/05/10 00:06:53  mharder
069     * Changed package from stringTransformer to stringtransformer.
070     *
071     * Revision 1.1  1999/07/28 22:17:18  las
072     * Initial checkin of stringTransformers code.  Note that
073     * UbbyDubbyTransformer is a noop and that NameDropper should really have
074     * a nicer gui and that there are a million other things I'd love to
075     * fix.  (Aren't there always?)
076     *
077     */