// ChatApplet.java -- chat client applet using Connection Manager // // import java.awt.*; import java.applet.*; import java.io.*; import java.net.*; public class ChatApplet extends ConnectionManagerClientApplet { ChatTextFrame frame; public void init () { name = "Chat"; frame = new ChatTextFrame (this, "Chat Window"); super.init (); } public void close () { frame.close (); super.close (); } // override server input handler inherited from Client public void notifyInput (String s) { frame.print (s); } } class ChatTextFrame extends TextFrame { ChatApplet parent; ChatTextFrame (ChatApplet p, String title) { super (title); parent = p; } public void notifyInput (String s) { parent.sendOutput (s); } public void notifyClose () { parent.close (); } }