import java.awt.*; import java.awt.event.*; /** * Simple top level frame that deals with one component and sizing. * @author * @author * @version $Id: DefaultFrame.java,v 1.1.1.1 2002/06/05 21:56:24 root Exp $ */ public class DefaultFrame extends Frame { public static void main( String[] args ) { System.out.print("Creating components.."); new DefaultFrame( new AlphaCanvas() ).init(); System.out.println("..done!"); } private Component c; /** * This construtor is private; no one should ever create a * DefaultFrame without a Component. */ private DefaultFrame() { super("Default"); c = null; } /** * Create a Frame containing only Component. * @param the Component to install in the Frame. */ public DefaultFrame(Component c) { super("Default"); this.c = c; } /** * Make the Frame appear. Must be called or Frame will not be * visible/usable. Also sets up Listener connection to handle * closing events. */ public void init() { this.addWindowListener( new WindowClosingListener( this ) ); this.add("Center",c); this.pack(); this.show(); } }