|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
rmi.ChatParticipant
rmi.ChatClient
public class ChatClient
Class for client for simple chat program. An object of this class provides the functionality needed to communicate with the server and other clients; the user interface is provided by an object of a class implementing the ChatClientUI interface.
Field Summary |
---|
Fields inherited from class rmi.ChatParticipant |
---|
clients, errorPrefix, serverPrefix |
Fields inherited from class java.rmi.server.RemoteObject |
---|
ref |
Constructor Summary | |
---|---|
ChatClient(java.lang.String name,
java.lang.String serverHost,
ChatClientUI ui)
Constructs client object, querying server for a list of other clients and displaying this information. |
Method Summary | |
---|---|
void |
addClient(ChatClientInterface c)
Adds client, displaying some info about the new client. |
void |
display(java.lang.String message)
Displays message, using whatever method is provided by the user interface for the client. |
java.lang.String |
getAddress()
Gets client's hostname/IPA. |
java.lang.String |
getMessagePrefix()
Gets prefix for messages broadcast by this object. |
java.lang.String |
getScreenName()
Gets client's screen name. |
void |
removeClient(ChatClientInterface c)
Removes client, displaying some info about it. |
void |
shutdown()
Shuts down, notifying server that we're leaving. |
void |
startup()
Starts up. |
Methods inherited from class rmi.ChatParticipant |
---|
broadcast |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
---|
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
---|
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
---|
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface rmi.ChatParticipantInterface |
---|
broadcast |
Constructor Detail |
---|
public ChatClient(java.lang.String name, java.lang.String serverHost, ChatClientUI ui) throws java.rmi.RemoteException, java.rmi.NotBoundException, java.net.MalformedURLException
name
- screen nameserverHost
- host where server is runningui
- user interface for client (provides something on
which to display messages, etc.)
java.rmi.RemoteException
java.rmi.NotBoundException
java.net.MalformedURLException
Method Detail |
---|
public void addClient(ChatClientInterface c) throws java.rmi.RemoteException
addClient
in interface ChatParticipantInterface
addClient
in class ChatParticipant
c
- client to add
java.rmi.RemoteException
public void removeClient(ChatClientInterface c) throws java.rmi.RemoteException
removeClient
in interface ChatParticipantInterface
removeClient
in class ChatParticipant
c
- client to remove
java.rmi.RemoteException
public java.lang.String getScreenName() throws java.rmi.RemoteException
getScreenName
in interface ChatClientInterface
java.rmi.RemoteException
public java.lang.String getAddress() throws java.rmi.RemoteException
getAddress
in interface ChatClientInterface
java.rmi.RemoteException
public void display(java.lang.String message) throws java.rmi.RemoteException
display
in interface ChatParticipantInterface
message
- message to display
java.rmi.RemoteException
public void startup() throws java.rmi.RemoteException
startup
in interface ChatClientInterface
java.rmi.RemoteException
public void shutdown() throws java.rmi.RemoteException
shutdown
in interface ChatClientInterface
java.rmi.RemoteException
public java.lang.String getMessagePrefix()
getMessagePrefix
in class ChatParticipant
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |