I am making a simple 1v1 \"private chat\" using TCP in java. Currently, i have a problem whenever i am using JButtons. This is my first attempt at using JButtons and ActionListe
Your server code runs well, but your client is blocking the Event Dispatching Thread when you call connectToServer
.
The Event Dispatching Thread is responsible for, amongst other things, processing repaint requests and new input events. If you block this thread for any reasons, then there is no way that the Event Dispatching Thread can process any new events...
All blocking or long running tasks should be executed out side of the context of the Event Dispatching Thread.
Take a look at Concurrency in Swing for more details