I've written a chat room in java that uses a client and a server. I've implemented multiple clients, which works but when the you write a message, user 2 has to click the submit button to view what i sent.
E.g:
***************************
if ((e.getSource() == submitButton)||(e.getSource() == message))
{
try
{
out.println(message.getText());
response = in.readLine();
output.setText(output.getText() + response + "\n"
;
message.setText(""
;
}
}
*************
I understand why this happens, and i think i've got to implement a listener that constantly listens for new inputs on the readLine.in
any ideas of how to do this?????
cheers
chris
E.g:
***************************
if ((e.getSource() == submitButton)||(e.getSource() == message))
{
try
{
out.println(message.getText());
response = in.readLine();
output.setText(output.getText() + response + "\n"
message.setText(""
}
}
*************
I understand why this happens, and i think i've got to implement a listener that constantly listens for new inputs on the readLine.in
any ideas of how to do this?????
cheers
chris