// Class Successor:
//     Produce all integers in increasing order from given first one

// Code does not include statements supporting trace display

// Include Stream class here

import java.awt.*;

class IntObject
{
   int number;
   
   public IntObject (int n) { number = n; }
   public int valueOf () { return number; }
}

class Successor extends Stream
{
   int number;
   
   public Successor(int n) { number = n;  }   
   
   public void run ()
   {
      while (true)
      {
         putIt(new IntObject(number++));
      }
   }
}

public class Succ extends java.applet.Applet
{
   Stream succ;
   TextField out;
   Object object;
   ...
   
   public void init ()
   {
      ...
      succ = new Successor(1);
      ...
   }
   ...
   public boolean action (Event evt, Object obj)
   {
      ...
      object = succ.next();
      int n = ((IntObject)(object)).valueOf();
      out.setText(out.getText()+" "+n);
      ...
      return super.action(evt, obj);
   }
}