This applet simulates a network chat, in which the user chats with someone over a network. Here, there is no network. The partner is simulated by a thread that emits strings at random. The point of the simulation is to show how to use a separate thread for receiving information.

The applet has an input box where the user enters messages. When the user presses return, the message is posted to a text area. In a real chat program, it would be transmitted over the network. When a (simulated) message is received from the other side, it is also posted to this text area.

The partner thread is started the first time the user sends a message.

0 Shares
Share
+1
Tweet
Share
Stumble