import java.applet.*; import java.awt.*; import java.io.*; import java.net.*; public class Lk01 extends Applet { private String serverName = "193.40.238.40"; private String chatChannel = "Default"; private int serverPort=3015; private String ise="1"; private StringBuffer teised=new StringBuffer("xxxxx"); Puks puks; Thread chatConnectionThread; TextArea textDisplayArea=new TextArea(20, 20), t0=new TextArea(20, 20), t1=new TextArea(20, 20), t2=new TextArea(20, 20), t3=new TextArea(20, 20), t4=new TextArea(20, 20); TextArea textInputArea=new TextArea(20, 20); Button sendButton; Rectangle r; Panel bottomPanel; private int previousEvKey = 0; public void init() { r=this.bounds(); add(textInputArea); textInputArea.hide(); //add(textDisplayArea); //add(t3); //add(t4); //textInputArea.show(); //textDisplayArea.show(); //t3.show(); //t4.show(); textInputArea.reshape(0, 0, 200, 200); //textDisplayArea.reshape((int)r.width/2, 0, (int)r.width/2, (int)r.height/4); //t3.reshape(0, (int)r.height/4, (int)r.width/2, (int)r.height/4); //t4.reshape((int)r.width/2, (int)r.height/4, (int)r.width/2, (int)r.height/4); showStatus(" "+r.height); // bottomPanel = new Panel(); // bottomPanel.setLayout(new BorderLayout()); // bottomPanel.add("North", textInputArea = new TextArea(5, 80)); add( sendButton = new Button("Send")); // setLayout(new BorderLayout()); // add("South", bottomPanel); // add("Center", textDisplayArea = new TextArea(20, 80)); // textDisplayArea.setEditable(false); puks = new Puks( serverName, serverPort, chatChannel, textDisplayArea ); chatConnectionThread = new Thread(puks); chatConnectionThread.start(); } public boolean action(Event ev, Object ob) { if (ev.target.equals(sendButton)) { String message = textInputArea.getText(); puks.write("t"+ise+teised+"o"+message); textInputArea.setText(""); textInputArea.show(); textInputArea.reshape((int)r.width/2, 0, 100, 100); return true; } showStatus(" "+r.height); return super.action(ev, ob); } public void seaise(String s){ this.ise=s; } }