/* * ==================================================================== * Create Simple GUI with Text Area and Canvas * * Written By : Mark Austin September 1997 * ==================================================================== */ import java.awt.*; public class TestCanvas { Graphics g; public static void main( String args[] ) { // Define window frame. Frame f = new Frame("Simple Text Area Interface"); f.setLayout(new GridLayout(2,1,20,20)); // Create text areas and add to the window frame Canvas c = new Canvas(); TextArea t = new TextArea( "Text Area2", 20, 40 ); c.setBackground(Color.green); c.resize(350, 350); f.add( c ); f.add( t ); f.resize(350, 450); f.show(); } public void paint ( Graphics g ) { Font font1 = new Font( "Courier", Font.PLAIN, 20 ); g.setColor( Color.black ); g.setFont( font1 ); g.drawString("This is a note", 50, 50); } }