Class prominence.chat.Chatboard
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class prominence.chat.Chatboard

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----prominence.chat.Chatboard

public class Chatboard
extends Panel
implements ChatClient
A text-based chat tool; this is a Panel that implements the ChatClient interface, and is added to the Chat Frame. Messages from other clients are displayed in a large TextArea at the top; the user can enter information in a TextField at the bottom.
See Also:
ChatClient, Chat

Variable Index

 o input
The input region.
 o o
The outbound message stream.
 o output
The output region.
 o r
A registry of users.

Constructor Index

 o Chatboard(Registry)
Creates a new Chatboard with an output TextArea and an input TextField.

Method Index

 o action(Event, Object)
Handles input from the user.
 o disconnected()
Sets the input TextField to uneditable.
 o preferredSize()
Returns the preferred size of this component.
 o receive(DataInputStream)
We implement the ChatClient interface so this method is not used.
 o receive(DataInputStream, String)
Receives a message from the peer Chatboard of the indicated client.
 o setMessageOutput(MessageOutput)
Assigns a message output stream over which this tool can communicate.

Variables

 o output
  protected TextArea output
The output region.
 o input
  protected TextField input
The input region.
 o r
  protected Registry r
A registry of users.
 o o
  protected MessageOutput o
The outbound message stream.

Constructors

 o Chatboard
  public Chatboard(Registry r)
Creates a new Chatboard with an output TextArea and an input TextField.

A registry of clients is used to determine whether messages should be broadcast or sent to a specific selection of clients.

Parameters:
r - The user registry

Methods

 o setMessageOutput
  public void setMessageOutput(MessageOutput o)
Assigns a message output stream over which this tool can communicate. This method is called by the GenericClient class with a message stream that is multiplexed to peer Chatboards of other clients.
Parameters:
o - The message output stream
See Also:
GenericClient
 o receive
  public void receive(DataInputStream i)
We implement the ChatClient interface so this method is not used.
 o receive
  public void receive(DataInputStream i,
                      String from)
Receives a message from the peer Chatboard of the indicated client.
Parameters:
i - A stream from which the message can be read
from - The name of the message sender
See Also:
receive
 o disconnected
  public void disconnected()
Sets the input TextField to uneditable. This is called when the server connection is closed, or this tool is deregistered.
See Also:
closedown, deregister
 o preferredSize
  public Dimension preferredSize()
Returns the preferred size of this component.
Overrides:
preferredSize in class Container
 o action
  public boolean action(Event e,
                        Object arg)
Handles input from the user. Sends a message to the currently selected users in the client registry.
Overrides:
action in class Component
See Also:
targets

All Packages  Class Hierarchy  This Package  Previous  Next  Index