This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Listening for Function Keys

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm not sure if this is the correct forum for this question. If it isn't, please point me to the correct place.

I have an application that runs in websphere. There is a main webpage with frames. It uses functions in a java class file.

I need to set this app up so that it will listen for function keys. Specifically I need to capture F1 and point it to the app help instead of IE's help. I also want to be able to capture other Fkeys and have them perform other functions that are available in the main page by clicking on controls.

The issue that I'm having trouble with is how to register the listener. I don't have a control to register it to. I want the app to do the listening and act appropriately.

I would appreciate any help that can be offered.

Thanks,

Doug Harding
State of Utah / Division of Finance
 
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doug Harding hailing from State of Utah what you need here is
some Javascript to capture keys;also if required, you might make functions in your Java class and call those functions on Key event in Javascript


Example:


Here is the applet class

TestJREApplet extends Applet{

public static String jreExits(){

return "Found JRE";

}
}

Here in your web page you will have two things 1) Applet tag 2)Javascript


<Applet code="TestJREApplet" name="myApplet" height=1 width=1></Applet>


<Script>

function checkJRE(){

if(myApplet){

alert(myApplet.jreExits());
}

else {

// Applet not loaded, most probably no JRE installed on turned on

// do some work

}

}

</Script>


you might google for more on calling Applet from Javascript, and for key code, keyevents etc in JavaScript.

There is a difference in Netscape and IE regarding Javascript but many javascript code snippets work in both.

Thanks,

Maki Jav
[ December 06, 2006: Message edited by: Maki Jav ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!