Class ClientConsole

java.lang.Object
  |
  +--ClientConsole

public class ClientConsole
extends java.lang.Object
implements ChatIF

This class constructs the UI for a chat client. It implements the chat interface in order to activate the display() method. Warning: Some of the code here is cloned in ServerConsole


Field Summary
(package private)  ChatClient client
          The instance of the client that created this ConsoleChat.
static int DEFAULT_PORT
          The default port to connect on.
 
Constructor Summary
ClientConsole(java.lang.String host, int port)
          Constructs an instance of the ClientConsole UI.
 
Method Summary
 void accept()
          This method waits for input from the console.
 void display(java.lang.String message)
          This method overrides the method in the ChatIF interface.
static void main(java.lang.String[] args)
          This method is responsible for the creation of the Client UI.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port to connect on.

client

ChatClient client
The instance of the client that created this ConsoleChat.
Constructor Detail

ClientConsole

public ClientConsole(java.lang.String host,
                     int port)
Constructs an instance of the ClientConsole UI.
Parameters:
host - The host to connect to.
port - The port to connect on.
Method Detail

accept

public void accept()
This method waits for input from the console. Once it is received, it sends it to the client's message handler.

display

public void display(java.lang.String message)
This method overrides the method in the ChatIF interface. It displays a message onto the screen.
Specified by:
display in interface ChatIF
Parameters:
message - The string to be displayed.

main

public static void main(java.lang.String[] args)
This method is responsible for the creation of the Client UI.
Parameters:
args[0] - The host to connect to.