Thread: ChatGUI problem
View Single Post
  #2 (permalink)  
Old 06-12-2007, 02:19 PM
levent levent is offline
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
Hi

First of all you don't need these lines in your ChatClient. So i commented them. Those lines block the GUI without any reason since you already know ip address of the server:

Code:
keyboardReader = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter the IP address for the server: "); address = keyboardReader.readLine();
After commenting those lines, your code will work and both sides will send whatever you wrote in the textfield continuously. But i guess you dont want this, you want to send the data only when the user clicks send button. For that aim you need to modify run method of your Send class. You can define a boolean flag there. When user clicks to the "Send" button, you can set this flag on and thread only send content of the textfield when this flag is on.

Let us know if something is unclear or you have other problems.

Last edited by levent : 06-12-2007 at 02:22 PM.
Reply With Quote