Esempio n. 1
0
  public Irc(Sentence_itf s) {

    setLayout(new FlowLayout());

    text = new TextArea(10, 60);
    text.setEditable(false);
    text.setForeground(Color.red);
    add(text);

    data = new TextField(60);
    add(data);

    Button write_button = new Button("write");
    write_button.addActionListener(new writeListener(this));
    add(write_button);
    Button read_button = new Button("read");
    read_button.addActionListener(new readListener(this));
    add(read_button);

    setSize(470, 300);
    text.setBackground(Color.black);
    show();

    sentence = s;
  }
Esempio n. 2
0
 // --------------------------------------------------
 public void close() {
   try {
     is.close();
     os.close();
     socket.close();
     responseArea.appendText("***Connection closed" + "\n");
   } catch (IOException e) {
     responseArea.appendText("IO Exception" + "\n");
   }
 }
Esempio n. 3
0
 // --------------------------------------------------
 public void run() {
   String inputLine;
   try {
     while ((inputLine = is.readLine()) != null) {
       responseArea.appendText(inputLine + "\n");
     }
   } catch (IOException e) {
     responseArea.appendText("IO Exception" + "\n");
   }
 }
Esempio n. 4
0
 // --------------------------------------------------
 public BaseTConn(String host, String port, TextArea commandArea, TextArea responseArea) {
   this.commandArea = commandArea;
   this.responseArea = responseArea;
   try {
     socket = new Socket(host, Integer.parseInt(port));
     os = new PrintStream(socket.getOutputStream());
     is = new DataInputStream(socket.getInputStream());
     responseArea.appendText("***Connection established" + "\n");
     new Thread(this).start();
   } catch (Exception e) {
     responseArea.appendText("Exception" + "\n");
   }
 }
Esempio n. 5
0
 // --------------------------------------------------
 public void send() {
   os.println(commandArea.getText());
 }