So this is in reference to my previous questions here and here. Basically the problem I am having is the program goes into the Server
class and stays there because there is a while look in the server code that essentially is continuously listening to the port for any response from the client; this makes the Main window completely unclickable since the program is not in the MainWindow
class.
But really what I want it to do is setup the connection and then go back to MainWindow
so the on-screen buttons are clickable. Or, as suggested by one poster, I could pass the MainWindow object by reference to the Server (which I have already done) and then use SwingUtilities.invokeLater()
but I'm not really looking to update the GUI. I'm looking to give control back to the GUI so the user can click buttons and such.
When it goes back to MainWindow
, I still need the connection to stay alive so the client can send things and I can receive it and display the received content on the screen for the user to control.