views:

215

answers:

1

Hello everyone. I'm dealing with a barcode reader in my java app. The problem is that the barcode, before and after reading and sending the actual barcode, sends a return code. I've some JTextFields and when the reader reads the barcode it change the focus, and then sends another return that makes the window to close. Is it anyway to "intercept" those "return" commands ?

+3  A: 

I think barcode readers (the hardware) can be programmed to not send returns after a read has been completed. They are generally programmed through reading barcodes from its user manual.

Bakkal
This is exactly the way to do it. You can even print configuration barcodes that would program your scanner to do nice things. For example send an F12 key before any scanned code. Capture the F12 in your program and move the focus to the appropriate field. This way you don't have to be at the appropriate field to scan the code.
rmarimon
First of all. Thanks for the answers. I've already know that. But i'm trying to make my app more "universal". Then, ther's no need to configurate anything. Just plug the barcode reader and start using it. Need something to filter every special char.
santiagobasulto
Then your scanner is wrongly configured or the barcode is providing extra characters. The standard barcode usually doesn't provide extra characters beyond the numbers (or characters) it represents. Try resetting your scanner to factory defaults.
rmarimon
I think santiagobasulto is saying that he understands that he can configure the device to behave exactly as he likes, but he is interested in finding a way to use the device in its default out-of-the-box configuration to be more user-friendly.
Scott W