Class ChatConnection

java.lang.Object
  |
  +--ChatConnection
All Implemented Interfaces:
java.lang.Runnable

public class ChatConnection
extends java.lang.Object
implements java.lang.Runnable


Constructor Summary
ChatConnection(javax.swing.JTextArea X, javax.swing.JScrollPane Y)
           
 
Method Summary
 void close()
          Closes the chat connection input and output streams
 boolean open(java.lang.String IPAddress, int PortNumber)
          Opens a connection to the server at the given IP address and port number.
 void run()
          This method is from the runnable interface.
 void sendMessage(java.lang.String Text)
          Outputs a message to all the other chat users.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChatConnection

public ChatConnection(javax.swing.JTextArea X,
                      javax.swing.JScrollPane Y)
Method Detail

open

public boolean open(java.lang.String IPAddress,
                    int PortNumber)
Opens a connection to the server at the given IP address and port number. This also starts a thread that will listen to that connection and output incoming text to the chat window.

close

public void close()
Closes the chat connection input and output streams

run

public void run()
This method is from the runnable interface. This method listends for incoming text, and displays any incoming text to the JTextArea.
Specified by:
run in interface java.lang.Runnable

sendMessage

public void sendMessage(java.lang.String Text)
Outputs a message to all the other chat users.