aspose file tools*
The moose likes Beginning Java and the fly likes KeyListner for non-awt-swing class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "KeyListner for non-awt-swing class" Watch "KeyListner for non-awt-swing class" New topic
Author

KeyListner for non-awt-swing class

Liming Xu
Greenhorn

Joined: Jan 22, 2002
Posts: 19
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
Liming Xu
Greenhorn

Joined: Jan 22, 2002
Posts: 19
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.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
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
Liming Xu
Greenhorn

Joined: Jan 22, 2002
Posts: 19
Thanks Cindy.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: KeyListner for non-awt-swing class