This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Hi all, I have a bean class and I want to register it so that it's able to do something when a Keyboard event is fired. It's not a AWT/SWing componet...because I want it to be able to get keyboard stroke without providing any visual components. How do I do that? Thanks a lot. Liming
Joined: Jan 22, 2002
BTW, mabye it'll be more clear this way. We are writing an application for a Scanner utitly(web based). Many scanner on the market connects to PS/2 keyboard port, so when the clients scan using this kind of Scanner, we want to be able to read the keyboard characters behind the background by invoke a bean class. The web developer will call my bean from a page, and my bean is suppose to sit in the background and read keyboard events. Obviously, I can't ask ppl to open a command prompt whenver the user reach that webpage, (btw, user is on serverside as well), so reading input from command prompt is not going to help.
All of the events in Java are in the AWT and are intended for GUI interactions. If you want to watch for stuff outside of a Java GUI you are going to need to use some operating system level operations, which of course will prevent it from being platform independant. The best that I can suggest is to see how the Java events are handled in the AWT and "borrow" some of that code to use as a basis for what you need. and Lim, Please change your name to be compliant with JavaRanch's naming policy. Your ID should be 2 separate names with more than 1 letter each. We really want this to be a professional forum and would prefer that you use your REAL name. Thanks, Cindy
"JavaRanch, where the deer and the Certified play" - David O'Meara