import java.awt.*; /** * Prints (by appending) a list of Integers onto a TextArea AWT object. * It does not clear the text area before writing to it. * Returns null always. */ public class TextAreaPrint implements FLVisitor_I { private TextArea pad; public TextAreaPrint(TextArea p) { pad = p; } public Object forEmpty(Empty host) { return null; // Nothing to print here. } public Object forCons(Cons host) { // appends the integer value of the data as a new line onto the TextArea: pad.append(host.first().toString() +'\n'); // modifies pad !!! return host.rest().execute(this); // recur on the rest of the list. } }