|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMsgUser
public class MsgUser
Represents a Java Messenger user.
Constructor Summary | |
---|---|
MsgUser(Server theServer,
java.lang.String name,
java.lang.String pswd)
Constructs a new user with a given screen name and password. |
Method Summary | |
---|---|
void |
addBuddy(MsgUser u)
If myWindow is initialized, adds u to its set
of buddies by calling
myWindow.addBuddy(u) . |
int |
compareTo(MsgUser other)
Compares this user to another by comparing their screen names case blind. |
boolean |
equals(java.lang.Object other)
Indicates whether some other user is "equal to" this one, based on comparing their screen names case blind. |
java.lang.String |
getName()
Returns the screen name for this user. |
java.lang.String |
getPassword()
Returns the password for this user. |
void |
openDialog(java.util.Set<MsgUser> buddies)
Creates a new MsgWindow for this user and saves
a reference to it in myWindow . |
void |
quit()
Logs out this user by calling server.logout(this) . |
void |
receiveMessage(java.lang.String text)
If myWindow is initialized, shows the received message by calling
myWindow.showMessage(text) . |
void |
removeBuddy(MsgUser u)
If myWindow is initialized, removes u from its set
of buddies by calling
myWindow.removeBuddy(u) . |
java.lang.String |
toString()
Returns this user's screenName . |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MsgUser(Server theServer, java.lang.String name, java.lang.String pswd)
theServer
- the server for this user.name
- user name.pswd
- password.Method Detail |
---|
public java.lang.String getName()
public java.lang.String getPassword()
public int compareTo(MsgUser other)
compareTo
in interface java.lang.Comparable<MsgUser>
other
- the reference to a user with which to compare.
other
.public boolean equals(java.lang.Object other)
ClassCastException
if other is not
an instance of user
.
equals
in class java.lang.Object
other
- the reference to an object with which to compare.
other
's;
false otherwise.public void openDialog(java.util.Set<MsgUser> buddies)
MsgWindow
for this user and saves
a reference to it in myWindow
.
buddies
- the set of this user's buddies.public void addBuddy(MsgUser u)
myWindow
is initialized, adds u
to its set
of buddies by calling
myWindow.addBuddy(u)
.
u
- a buddy to be added.public void removeBuddy(MsgUser u)
myWindow
is initialized, removes u
from its set
of buddies by calling
myWindow.removeBuddy(u)
.
u
- a buddy to be removed.public void receiveMessage(java.lang.String text)
myWindow
is initialized, shows the received message by calling
myWindow.showMessage(text)
.
text
- a message to be displayed.public void quit()
server.logout(this)
.
(This method is called from the MsgWindow
's window listener
when the "close window" button is clicked.)
public java.lang.String toString()
screenName
.
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |