|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ChatWindow
A ChatWindow is a window which handles the user interaction of one active chat session. The window consists of two main parts. The upper part of the window consists of a scrollable text field into which incoming messages (as well as your own) can be written. The text field is read-only to the user. The lower part of the window consists of a single-line input field into which the user can type his own, out-going, messages. A button which can be used to submit the text in the input field to the chat system is located next to the input field.
Input, that is messages entered into the input field, is handled by
the messageEntered
method which is called automatically
whenever the user clicks on the submit button. The intention is that the
ChatWindow class should be used as a super class to another class which
overloads the messageEntered
method. The overloaded method
should contain the Java code to be executed when a new message is entered.
Another possible way of using the class is to modify the ChatWindow class
directly, putting the code to be executed when a new message is entered
directly in the messageEntered
method.
Constructor Summary | |
ChatWindow(int x,
int y,
java.lang.String title)
Constructs a ChatWindow at a given position on the screen and with a given title which is displayed in the title bar of the window. |
Method Summary | |
void |
add(java.lang.String message)
Adds a new message to the message area in the upper part of the ChatWindow. |
void |
clear()
Clears the contents of the message area in the upper part of the ChatWindow. |
void |
destroy()
Destroys the ChatWindow and frees all resources associated with it. |
void |
hide()
Makes the ChatWindow invisible. |
void |
messageEntered(java.lang.String message)
The messageEntered method is called whenever the user
submits a new message and controls how to handle the new message. |
void |
show()
Makes the ChatWindow visible. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ChatWindow(int x, int y, java.lang.String title)
show
method in order to display the window.Note: Depending on which window manager/window system you use, both window title and position might be ignored.
x
- the x coordinate of the position of the windowy
- the y coordinate of the position of the windowtitle
- a String containing the title to be displayed in
the title bar of the windowMethod Detail |
public void add(java.lang.String message)
message
- a String containing the message to addpublic void clear()
public void hide()
show
to make the
window visible again.
show()
public void show()
show
method. Call hide
to make the
window invisible again.
hide()
public void destroy()
destroy
method should be called when the ChatWindow
is not needed anymore. Note that it is ILLEGAL to call any
method of the ChatWindow object once destroy
has
been called.
public void messageEntered(java.lang.String message)
messageEntered
method is called whenever the user
submits a new message and controls how to handle the new message.
The intention is that this method should be overloaded in a
subclass to ChatWindow. The default implementation found in the
ChatWindow class does nothing.
message
- a String containing the new message entered by
the user
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |