This is a companion page to the main JavaWorld article.
Applet variant of the
ChatClient class. The code is essentially the same as the original
ChatClient class, except that the host name and port come from
parameters, and the class must fit within the Applet execution
model with init(), start() and stop()
methods.
Chat Applet
Note that this Applet will not operate correctly through
a firewall or proxy; the client will not be permitted to open a direct
Socket connection back to the server. It also may not work
with Netscape for Macintosh; the Mac-based Java VM still appears to
be teething. Finally, you'll notice that once the window fills up with
type, additinal lines don't become visible unless you manually
scroll downward (using the scroll bar, of course). This inconvience
is due to an AWT bug.
If the client encounters a problem connecting to the server, an exception will be thrown. If you can't connect, the server may be having difficulties; it is running on a lamentable Linux box. Try reloading the page to see if you can connect later.
To return to the article, just follow this link.