AppletThreadLister.javaAPI DocExample1018Sat Jun 02 03:13:10 BST 2001None

// This example is from the book _Java in a Nutshell_ by David Flanagan.
// Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates.
// You may study, use, modify, and distribute this example for any purpose.
// This example is provided WITHOUT WARRANTY either expressed or implied.

import java.applet.*;
import java.awt.*;

public class AppletThreadLister extends Applet {
    TextArea textarea;
    // Create a text area to put our listing in
    public void init() {
        textarea = new TextArea(20, 60);
        Dimension prefsize = textarea.preferredSize();
        this.resize(prefsize.width, prefsize.height);
    // Do the listing.  Note the cool use of ByteArrayOutputStream.
    public void start() {
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        PrintStream ps = new PrintStream(os);