FileDocCategorySizeDatePackage
PrintThread.javaAPI DocExample1711Tue Dec 12 18:57:28 GMT 2000None

PrintThread

public class PrintThread extends Applet

Fields Summary
TextArea
display
int
paintCount
String
newline
Constructors Summary
Methods Summary
voidaddItem(java.lang.String newWord)

        System.out.println(newWord);
        display.append(newWord + newline);
        display.repaint();
        //A hack to get the applet update() method called
        //occasionally:
        if (++paintCount % 4 == 0) {
            repaint();
        }
    
public voiddestroy()

        addItem("destroy: " + threadInfo(Thread.currentThread()));
	//removeAll();	//XXXAppletViewer allows 2 init calls.
    
public voidinit()


       
        //Create the text area and make it uneditable.
    	display = new TextArea(1, 80);
        display.setEditable(false);

	//Set the layout manager so that the text area 
	//will be as wide as possible.
        setLayout(new java.awt.GridLayout(1,0));

	//Add the text area to the applet.
        add(display);

	//Find the platform-dependent newline character.
	newline = System.getProperty("line.separator");

        addItem("init: " + threadInfo(Thread.currentThread()));
    
public voidstart()

        addItem("start: " + threadInfo(Thread.currentThread()));
    
public voidstop()

        addItem("stop: " + threadInfo(Thread.currentThread()));
    
java.lang.StringthreadInfo(java.lang.Thread t)

        return "thread=" + t.getName() + ", "
               + "thread group=" + t.getThreadGroup().getName();
    
public voidupdate(java.awt.Graphics g)

        addItem("update: " + threadInfo(Thread.currentThread()));
        super.update(g);