import java.io.*; import java.awt.*; import java.awt.event.*; import java.applet.Applet; public class StrightKlient extends Applet implements ActionListener, Runnable{ TextField tf=new TextField(); TextArea ta=new TextArea(); public StrightKlient(){ setLayout(new BorderLayout()); add(tf, BorderLayout.SOUTH); add(ta, BorderLayout.CENTER); tf.addActionListener(this); new Thread(this).start(); } public void run(){ try{ BufferedReader sisse=new BufferedReader( new InputStreamReader(System.in)); String rida=sisse.readLine(); while(rida!=null){ ta.append(rida+'\n'); rida=sisse.readLine(); } }catch(Exception ex){System.err.println(ex.getMessage());} } public void actionPerformed(ActionEvent e){ System.out.println(tf.getText()); } public static void main(String[] arg){ Frame f=new Frame(); f.add(new StrightKlient()); f.setSize(300, 300); f.setVisible(true); } }