aspose file tools*
The moose likes Java in General and the fly likes detect device from which input is provided Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "detect device from which input is provided" Watch "detect device from which input is provided" New topic
Author

detect device from which input is provided

Preston Taylor
Greenhorn

Joined: Feb 18, 2010
Posts: 7
I am writing a program that needs to accept input from a bar code scanner, which is really not the issue since most scanners are just a keyboard, but because I can't trust the users to input non-falsified information I need certain text boxes to accept input from the scanner and the scanner only. how do I determine from what device text input is coming from?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18660
    
    8

If the operating system makes them look exactly like the keyboard, you don't have any hope of figuring out what hardware your keyboard inputs are coming from. (Or at least not much hope... scanning a barcode might send keystrokes faster than a human can, and you might be able to discern that with a KeyListener or something.) But I'd say your best approach would be, since it's an operating-system or hardware issue, to solve the problem at the operating-system or the hardware level.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

Paul Clapham wrote:scanning a barcode might send keystrokes faster than a human can, and you might be able to discern that with a KeyListener or something.

One word: macros. I have already programmed my keyboard to use a few, so with one press on my keyboard I can post entire pieces of text.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: detect device from which input is provided