How can you handle both Mouse and Keyboard Events in an Applet?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ryan_Hubbard
Posted On:   Tuesday, June 1, 2004 05:59 PM

I am creating an applet that involves clicking locations to select things and drive events. However, I also need to be able to toggle a value before clicking. I was attempting to do this using keyboard input, where KeyPressed() or some similar method would toggle the value back and forth. Strangely, though, when I added a Keyboard listening device (similar to the one here: http://www.jguru.com/faq/view.jsp?EID=45465) to the applet, the mouseDown() method stopped working. When I first start the applet, the keyboard will not work until I first click on the applet (the clicking does not call the mouseDown() method, but merely seems to put the input focus to the applet). After that first click, the input from the keyboard works and the user can toggle all day   More>>


I am creating an applet that involves clicking locations to select things and drive events. However, I also need to be able to toggle a value before clicking. I was attempting to do this using keyboard input, where KeyPressed() or some similar method would toggle the value back and forth. Strangely, though, when I added a Keyboard listening device (similar to the one here: http://www.jguru.com/faq/view.jsp?EID=45465) to the applet, the mouseDown() method stopped working. When I first start the applet, the keyboard will not work until I first click on the applet (the clicking does not call the mouseDown() method, but merely seems to put the input focus to the applet). After that first click, the input from the keyboard works and the user can toggle all day long, but the mouse no longer works. Why is the mouseDown() method never called? And any advice on how to fix this? I would appreciate anything; I'm completely baffled.

   <<Less
About | Sitemap | Contact