edu.rit.chat1
Class Chat

java.lang.Object
  extended by edu.rit.chat1.Chat
All Implemented Interfaces:
ChatFrameListener, ChatRef

public class Chat
extends Object
implements ChatRef, ChatFrameListener

Class Chat is a rudimentary M2MI-based chat application. The program displays a simple chat UI (an instance of class ChatFrame), and the program exports a chat object (an instance of class Chat) that implements interface ChatRef. When the user sends a line of text in the UI, the line is broadcast to all the chat objects by calling putLine() on an omnihandle for interface ChatRef. When each chat object receives a putLine() invocation, it displays the line of text in the chat log in its UI. In this way the line of text appears in all the chat programs that are running.

The chat demo is intended merely to demonstrate M2MI omnihandle invocations and is not intended to be a full-featured chat application.

Usage: java edu.rit.chat1.Chat username

When running the chat demo application, M2MI and M2MP must be configured, and the M2MP Daemon must be running if necessary. See packages edu.rit.m2mi and edu.rit.m2mp for further information.

The chat demo application displays this UI:

Type a line of text into any chat window on any machine and hit return or click the "Send" button. The line of text, prefixed by the user name, shows up in all the chat windows on all the machines.


Method Summary
static void main(String[] args)
          Main program.
 void putMessage(String line)
          Display the given line of text in this chat object's chat log.
 void run(String[] args)
          Run this chat application.
 void send(String line)
          Process the given line of text entered by the user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

run

public void run(String[] args)
         throws Throwable
Run this chat application.

Parameters:
args - Command line arguments.
Throws:
Throwable

send

public void send(String line)
Process the given line of text entered by the user.

Specified by:
send in interface ChatFrameListener
Parameters:
line - Line of text.

putMessage

public void putMessage(String line)
Display the given line of text in this chat object's chat log.

Specified by:
putMessage in interface ChatRef
Parameters:
line - Line of text.

main

public static void main(String[] args)
                 throws Throwable
Main program.

Parameters:
args - Command line arguments.
Throws:
Throwable


Copyright © 2001-2006 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.