Introduction
This is a basic java chat application for chatting on LAN. I am still a beginner in java, so I would like to improvise on the way I do my coding. That is the main reason for posting this article, as I hope the people in this community would suggest me better ways to implement the ideas.
Background
I have used swing and threads in this app. I have heard that it is not a good practice to use these two things together, so some suggestions would be great.
Using the code
The MyServer.java file is executed on the server side, in our case, we will do both the server and client parts on the same machine. While the server program is running, Login.java is run, which asks for the login name. After login a console is opened up which gives a list of online users. Any number of users can login by executing the Login.java
MyClient.java is the file which is
Blocks of code should be set as style "Formatted"
like this:
Remember to set the Language of your code snippet using the
Language dropdown.
Use the "var" button to to wrap Variable or class names in
<code> tags like this.
Points of Interest
Did you learn anything interesting/fun/annoying while writing
the code? Did you do anything particularly clever or wild or zany?
History
Keep a running update of any changes or improvements you've
made here.