home *** CD-ROM | disk | FTP | other *** search
/ Java by Example / jbecd.bin / JBE-CD / NTUsers / JBECODE.ZIP / JavaByExample / chap11 / Applet11.java < prev    next >
Encoding:
Java Source  |  1996-02-08  |  578 b   |  27 lines

  1. import java.awt.*;
  2. import java.applet.*;
  3.  
  4. public class Applet11 extends Applet
  5. {
  6.     public void paint(Graphics g)
  7.     {
  8.         int row = 0;
  9.  
  10.         for (int x=5; x<=40; x+=5)
  11.         {
  12.             String s = "Loop counter = ";
  13.             s += String.valueOf(x);
  14.             g.drawString(s, 80, row * 15 + 15);
  15.             ++row;
  16.         }
  17.  
  18.         for (int x=40; x>=5; x-=5)
  19.         {
  20.             String s = "Loop counter = ";
  21.             s += String.valueOf(x);
  22.             g.drawString(s, 80, row * 15 + 15);
  23.             ++row;
  24.         }
  25.     }
  26. }
  27.