Assignment 8: Simple Chatroom Dr. Huaqing Wang I. Purposes: - GUI programming, event handling - Socket and Cient-Server programming. - Multiple Threading - Monitor and Synchronization - Classic Synchronization Problems. II. Files: - Two files, SimpleServer.java and ChatClient.java are availbe on my website. - Two programs are tested running on the same and separatte machines. When client and server running on differnt machine, the host name must be changed to server mahine first. III. Key Conpcepts of Client-Server programming with Sockets - A soket can be thought as pipe with the following diferencecs - Pine are used to link two threads/processes running on the same machine while socket link to thread/process betwo two threads/proesses on the same or different machines. - Pipe is one-direction data channel while a pipe is bi-directional channel. - Java provide two socket classes: ServerSocket and Socket while Unix sysem has one socket. - Socke is one of mechanism for remonte connections, and RMI (remote method Innocation) is another one to be discussed later. IV. What You need to do for this assignment: Based on the ChatClient and SimpleServer, program. You will develop a simple chatroom client-server programs with following features 1. When client starts, (1) Add two JLabels before two JTextFields on the southe of the JFrame and labels them as "Name" and "Message". That is the layout likes Name ___________ Message __________________ (2) JTextField for message is disabled (not allow enter text until Client name is entered and RETURN is pressed. (3) After a name such as "John" is enterred, - socket connection is made to server, - name text box is disabled and messge box is enabled. - The window's title is changed to "John Is in Chat Room". (4) Replace current event handler of using current class, with two anonymous classes object for name and message JTextFields object. 2. Extra crdit (5 points) will be given to you if your program can send private message to selected chatters.