Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

handleEvent(Event event)

 
Ranch Hand
Posts: 371
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can some one please help? This is quite urgent.
 
Get out of my mind! Look! A tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic