Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Event Listeners

 
Melinda Wilson
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know is it possible to write an event to use the page up and page down key on the key board to scroll up and down on a web page. What I have read is that the Event Listeners are used in applets to call a key when a keyboard is pressed. I don't write applets, just front end JSPs with backend servlets. Is it even possible to do this though I have never been able to use pageup pagedown keys on web pages. Just wondering if anyone has even thought or tried.
Thanks!
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the Robot class to post key events to the event queue. You should be able to scroll by posting VK_PAGE_UP or VK_PAGE_DOWN.
There was an example of it posted in this thread http://www.javaranch.com/ubb/Forum1/HTML/001678.html
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic