All Keystrokes reach Java applets inside MSIE but not if ActiveX plugins like Sun's plugin or Oracle's JInitiator are used.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jayanta_Choudhuri
Posted On:   Monday, October 29, 2001 12:36 PM

JNC's KeyBoard Test Using Vanilla Applet I wrote the Applet "KeyStrokesForJncsApplet.java" to test how keystrokes reach embedded Java applets. F1 and F11 are Help & FullScreenToggle in InternetExplorer(MSIE) MSIE acts on these as usual outside the blue area - which is the applet focus. In the area of the applet F1, F11 as well as all other keys are consumed by the applet. In both Oracle Jinitiator as well as SUN Java Plugin the behaviour is NOT as nice. F1 & F10 create dual action. Both keys reach the applet. However F1 displays the MSIE help. F10 is not too bad -- it creates a loss of focus. One has only to click back and continue. But the good news   More>>
JNC's KeyBoard Test Using Vanilla Applet

I wrote the Applet "KeyStrokesForJncsApplet.java" to test how keystrokes reach embedded Java applets.


F1 and F11 are Help & FullScreenToggle in InternetExplorer(MSIE)
MSIE acts on these as usual outside the blue area - which is the applet focus.


In the area of the applet F1, F11 as well as all other keys are consumed by the applet.




In both Oracle Jinitiator as well as SUN Java Plugin the behaviour is NOT as nice. F1 & F10 create dual action. Both keys reach the applet. However F1 displays the MSIE help. F10 is not too bad -- it creates a loss of focus. One has only to click back and continue. But the good news is that all other keys are painless. Both are ActiveX Controls for MSIE.




Microsoft (MSDN) says ActiveX Controls should have full control on Mouse & Keyboard despite being Windowless and sitting inside a container(MSIE) with a window --

"Active and Inactive States of an ActiveX Control
A control has two basic states: active and inactive. Traditionally, these states were distinguished by whether or not the control had a window. An active control had a window; an inactive control did not. With the introduction of windowless activation, this distinction is no longer universal, but still applies to many controls.


When a windowless control goes active, it invokes mouse capture, keyboard focus, scrolling, and other window services from its container. You can also provide mouse interaction to inactive controls, as well as create controls that wait until activated to create a window.

When a control with a window becomes active, it is able to interact fully with the control container, the user, and Windows."




import java.applet.*;


import java.awt.*;


import java.awt.event.KeyEvent;



public class KeyStrokesForJncsApplet extends Applet {


Label jncs_label;



/** Initialize the Label, ask for keyboard focus */


public void init() {


jncs_label = new Label("Key Board Information");


this.add(jncs_label);


this.setBackground(Color.blue);


jncs_label.setBackground(Color.white);


this.requestFocus(); // Ask for keyboard focus so we get key events


this.enableEvents(AWTEvent.KEY_EVENT_MASK);


}



/** Respond to key presses: Erase drawing when user types 'e' */


public void processKeyEvent(KeyEvent e) {


String myKeyText;



if (e.getID() == KeyEvent.KEY_PRESSED) {


myKeyText=KeyEvent.getKeyText(e.getKeyCode());


if(myKeyText.equals("Control") ||


myKeyText.equals("Shift") ||


myKeyText.equals("Alt") )


myKeyText=" ";



jncs_label.setText("");



jncs_label.setText(


KeyEvent.getKeyModifiersText(e.getModifiers()) +


" " + myKeyText);


}


}



}










JNC's KeyBoard Test Using Vanilla Applet




codebase="."
width=300 height=300>









JNC's KeyBoard Test Using Sun's Java Plugin

JNC's KeyBoard Test Using Sun's Java Plugin




WIDTH = "300" HEIGHT = "300" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">





   <<Less
About | Sitemap | Contact