import java.net.*; import java.io.*; import java.awt.*; import java.awt.event.*; public class Klient2 extends Panel implements ActionListener{ TextField tf=new TextField(); Socket sc; PrintWriter kirjutaja; BufferedReader lugeja; public Klient2(){ setLayout(new BorderLayout()); add(tf, BorderLayout.SOUTH); tf.addActionListener(this); try{ sc=new Socket("10.254.55.91", 3001); kirjutaja=new PrintWriter(sc.getOutputStream(), true); } catch(Exception ex){System.out.println(ex);} } public void actionPerformed(ActionEvent e){ kirjutaja.println(tf.getText()); tf.setText(""); } public static void main(String[] arg){ Frame f=new Frame("jututoa klient"); f.add(new Klient2()); f.setSize(400, 300); f.setVisible(true); } }