final String name = input.trim();
// The chat frame contains all the Swing stuff.
chatFrame = new ChatFrame(host);
// Register the chat frame so the server can call methods on it.
new ObjectSpace(client).register(Network.CHAT_FRAME, chatFrame);
// This listener is called when the send button is clicked.
chatFrame.setSendListener(new Runnable() {
public void run () {
player.sendMessage(chatFrame.getSendText());
}