• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

handleEvent(Event event)

 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have two chat applet clients (one thru http and one thru socket)that has a TextField for inputing messages, and is setEditable(true).
Each has same handleEvent:
public boolean handleEvent(Event event) {
switch (event.id) {
case Event.ACTION_EVENT:
if (event.target == input) {
broadcastMessage(input.getText());
input.setText("");
return true;
}
}
return false;
}

However, when the applets are loaded, the http applet does not allow typing in words at all (even though the cursor is there), and the socket client, while allowing words to be typed in, when "Enter" key is pressed, nothing changes. What is wrong with my applets or browser?

 
maateen ashraf
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it just calles broadcast() method whenever any change event of textfield occurs so it immidiatly removes the character typed on textfield
that Y u are not looking any character typed over textfield
try to print null in text field after sending the message to server & getting boolean true flag.
& also send message after the complete character has written.
 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, but the same handleEvent allows the socket client to have words typed in the TextField. Also, we have to press "Enter" key to activate the action listener for a TextField, right? I didn't press the "Enter" key at any time, but no letters are showing up in the http client. Also, when I pressed "Enter" key in the socket client, the message was not cleared, and no message was displayed on the chat TextArea(used to display the conversation).
 
Cameron Park
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can some one please help? This is quite urgent.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic