Next: Server
Up: Client
Previous: Server Connection
  Contents
This is the main thread except for the Event Thread (the
Event Thread is the only thread where Swing Events take
place).
The Listening Thread, as it's name suggests,
Listens on the Connection object for incoming messages
from the CSICQ server. Each message received is first
identified for it's type, then an action is taken. The
actions taken by this thread are usually considered with
the GUI elements of the applet.
The following Event messages are currently dealt with in
the listening thread:
- Received Message: a message from an ICQ network user,
the message is printed on the status text area.
- Update Contact: an update of the status of a contact
list member. The Contact List object is updated.
- Push contact: the CSICQ server is adding a member to
the Contact List from the database. The member is added to
the contact list.
- Inform Disconnected: a notification of a disconnection
from the ICQ network. The applet state is changed to
Temporary Disconnection.
- Authorize login: the server has successfully logged
the user into the ICQ network. the applet status is switched
to Functional.
Since the GUI elements of the Applet are manipulated in the
Event Thread and can happen at the same time, some kind of
synchronization method is being used.
The method of synchronization implemented is using the
SwingUtilities Invoke Later method. This method simply
schedules a runnable object for later execution on the
Event Thread, thus all GUI changes are performed in one
thread with no hazards.
Figure 1:
A screen-shot of the applet
|
Next: Server
Up: Client
Previous: Server Connection
  Contents
Zvika Brakerski
2001-05-09