/* */ // AWT Demo - A simple applet using non-swing components and simple // graphics (no Java2D). Compare this program with SwingDemo. // This Applet uses a Button, a Label, and a Canvas for the static // inner class. // // This program adapted from Figure 5.3, p. 199, from Art Gittleman's // book "Internet Applications With the Java 2 Platform", (C)2001 // Scott/Jones Inc. // // Written by Wayne Pollock, Tampa Florida USA, 2/2001. import java.applet.*; import java.awt.*; public class AwtDemo extends Applet { public void init () { add( new Button( " One " ) ); add( new Label( " Two" ) ); MessagePane mp = new MessagePane(); add( mp ); mp.setBackground( Color.cyan ); mp.setSize( 100, 100 ); setBackground( Color.gray ); } public static class MessagePane extends Canvas { public void paint ( Graphics g ) { g.drawString( "AWT Demo", 20, 56 ); } } }
Send comments and mail to the WebMaster. |