Client and GUI concurrently ?
hi everybody,
i got a problem about gui and client. I have created a jframe and i want it to e client which connects to a server and gets the server's message. The problem is; when i created gui first, it starts to listen actions and client can't run, or if i run client class first, it starts to listen server message in a loop on run() method of thread() so action listener can't be catch. The simulation of code is below. Please help me.
public class GUILogin extends JFrame{
public static void main(String args[]) {
new Client("localhost",9999);
new GUILogin().setVisible(true);
}
public class Client implements Runnable{
public Client(String host, int port) {
new Thread(this).start();
}
//LISTENS THE SERVER MESSAGE
public void run() {
String str;
while ((str = readline()) != null) {
System.out.println(str);
}
}
}
I can't decide where to put client creation and gui creation.

