import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class Jutugrklient1 extends Applet implements Runnable, MouseListener{ BufferedReader sisse; PrintWriter valja; public Jutugrklient1(){ try{ Socket sc=new Socket("ws0.cs1.tpu.ee", 3001); sisse=new BufferedReader(new InputStreamReader(sc.getInputStream())); valja=new PrintWriter(sc.getOutputStream(), true); addMouseListener(this); }catch(Exception e){} // new Thread(this).start(); } public void mousePressed(MouseEvent e){ valja.println("jaagup "+e.getX()+" "+e.getY()); } public void mouseReleased(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseExited(MouseEvent e){} public void mouseClicked(MouseEvent e){} public void run(){ try{ while(true){ } }catch(Exception e){} } public static void main(String argumendid[]){ Frame f=new Frame("Ruudu joonistamine"); f.setSize(300, 300); f.add(new Jutugrklient1()); f.setVisible(true); } }