aspose file tools*
The moose likes Applets and the fly likes Listening for Function Keys Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Listening for Function Keys" Watch "Listening for Function Keys" New topic
Author

Listening for Function Keys

Doug Harding
Greenhorn

Joined: Apr 03, 2005
Posts: 8
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
Maki Jav
Ranch Hand

Joined: May 09, 2002
Posts: 435
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 ]

Help gets you when you need it!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Listening for Function Keys