import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class Jutuklient2 extends Applet implements Runnable{ TextArea ta=new TextArea(); BufferedReader sisse; public Jutuklient2(){ add(ta); try{ Socket sc=new Socket("ws0.cs1.tpu.ee", 3001); sisse=new BufferedReader(new InputStreamReader(sc.getInputStream())); }catch(Exception e){} new Thread(this).start(); } public void run(){ try{ while(true){ ta.append(sisse.readLine()+"\n"); } }catch(Exception e){} } public static void main(String argumendid[]){ Frame f=new Frame("Ruudu joonistamine"); f.setSize(300, 300); f.add(new Jutuklient2()); f.setVisible(true); } }