public class Chat extends Applet implements Runnable { TextArea ta; TextField tf; Socket s; Thread t;
public void init() { ta = new TextArea("",20,80); ta.setEditable(false); add(ta);
tf = new TextField(80); add(tf); }
public void start() { try { String host = getParameter("host"); int port = Integer.parseInt(getParameter("port")); s = new Socket(host,port); t = new Thread(this); t.start(); } catch(Exception e) { ta.appendText("applet error: "+e+"/n"); } }