home *** CD-ROM | disk | FTP | other *** search
/ Java by Example / jbecd.bin / JBE-CD / NTUsers / JBECODE.ZIP / JavaByExample / chap11 / Applet10.java < prev    next >
Text File  |  1996-02-08  |  606b  |  30 lines

  1. import java.awt.*;
  2. import java.applet.*;
  3.  
  4. public class Applet10 extends Applet
  5. {
  6.     TextField textField1;
  7.  
  8.     public void init()
  9.     {
  10.         textField1 = new TextField(20);
  11.         add(textField1);
  12.         textField1.setText("Moe Howard");
  13.     }
  14.  
  15.     public void paint(Graphics g)
  16.     {
  17.         g.drawString("Enter a name above.", 70, 45);
  18.         String s = textField1.getText();
  19.  
  20.         for (int x=0; x<10; ++x)
  21.             g.drawString(s, 80, x * 15 + 70);
  22.     }
  23.  
  24.     public boolean action(Event event, Object arg)
  25.     {
  26.         repaint();
  27.         return true;
  28.     }
  29. }
  30.