Java Chat Program

I worked on this program in my spare time at home and at work(with the blessing of my supervisor). I have been busy at work and have not had time to work on this much so it’s taken longer than I had hoped to complete.


Issues I ran into while making to program where the following:

  • You can see the formatting I used for the chat box in screen shot #2. I originally had an issue with the colons lining up. After some trial and error I realized it was the font I was using. I switched to a monospace font and the colons lined up everytime.


  • I also had an issue with the list of users being updated.  If Client 1(Eric) logged on it would show Eric in the UserList. When Homer logged on Eric’s client window would have Homer added to his userList, but Homer would only see himself. I originally set it to only send out the username of the last user that logged in. The newest user needed a list of all users logged in. So I created an ArrayList on the server to keep track of the users. I sent the users to the newest client in a comma delimited string made by looping though the ArrayList. The Client then takes that string and puts it into the userList, sorted alphabetically of course.



Here’s some screenshots of the program.

Login Screenshot:








Client Screenshot after login:








Server Screenshot:








Downloads for Program

Chat Client
Chat Server
Chat Server Connection

IF you see that this code can be improved upon in anyway please comment below so everyone can learn from it.