Hello Guys,
I am creating a simple chat application that will run from a serverSocket to a socket on a client host.
ok i have got it to work. there is a textfield, send and exit button.
what i would like to do it to be able to add a checkbox that will allow for character by character sending over the sockets. instead of line by line and then press the send button.
so what i started to do is for my the client and server application to implement KeyListener
so when a key is typed it will do this
public void keyTyped(KeyEvent arg0) {
try {
System.out.print(arg0.getKeyChar());//just for testing if keyTyped works
bw.write(arg0.getKeyChar());//bw being my buffered writer
bw.newLine();
/* i had to call this method and the one below so that the character could be displayed on the other application. my problem is that the characters are going to a new line everytime a key is pressed. if i take out the newLine() method then it does not display the character*/
bw.flush();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
i am a bit stuck for the moment . if some one could help that would be great/