This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Applets and the fly likes Add Enter Key Value in Input Box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Applets
Bookmark "Add Enter Key Value in Input Box" Watch "Add Enter Key Value in Input Box" New topic
Author

Add Enter Key Value in Input Box

Darren Alexandria
Ranch Hand

Joined: Aug 17, 2007
Posts: 185
Good day!

How can I add an "Enter Key Value" in a input field after it has been filled with data?
My data is coming from a barcode reader.

I have tried to read a barcode that will set the barcode reader with an enter and a double
enter key, but this doesn't work.

What I am trying to do is to automatically generate data with the given data that will be inputted
in the input box, without clicking any button.

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42047
    
  64
What do you mean by "add an "Enter Key Value" in a input field" - do you want to wait until the field has been populated, and then append a newline (or carriage return character) to it? if so, I think you can add an ActionListener to it; that will be called whenever the contents of the field change.


Ping & DNS - my free Android networking tools app
Darren Alexandria
Ranch Hand

Joined: Aug 17, 2007
Posts: 185
Yes, you got my point.
So what I should do now is to add an Action Listener to the applet code?

Thanks so much.

Darren
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42047
    
  64
Yes, you'd add it to the TextField.
Darren Alexandria
Ranch Hand

Joined: Aug 17, 2007
Posts: 185
Thanks!

God bless.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Add Enter Key Value in Input Box