• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Pressing Tab key in IE with latest JRE version

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,



I have question about typing "TAB" key in Java Applet in internet explorer with JRE 1.05_08 or above.
When I type any key other than "TAB", the function, processEvent, will be called 3 times to process keyPressed, keyTyped and keyReleased. However, when I type "TAB" key, processEvent is only called once to process keyTyped and the focus goes outside the applet.

Is there any way that the focus won't get lost when typing the "TAB" key?

Note that this problem only happens in IE browser with JRE 1.05_08 or above. It works well in Firefox and netscape with any JRE version and works well in IE with JRE 1.05_06 and below.


The following is my code:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class KeyEventDemo extends Applet implements KeyListener, FocusListener {
public KeyEventDemo() {
super();
addKeyListener(this);
addFocusListener(this);
}
public void keyTyped(KeyEvent e) {
System.out.println("KEY TYPED: e="+e);
}
public void keyPressed(KeyEvent e) {
System.out.println("KEY PRESSED: e="+e);
}
public void keyReleased(KeyEvent e) {
System.out.println("KEY RELEASED: e="+e);
}
public boolean keyDown(Event e, int key) {
System.out.println("keyDown: e="+e);
return false;
}
public boolean keyUp(Event e, int key) {
System.out.println("keyUp: e="+e);
return false;
}
public void processEvent(AWTEvent e) {
System.out.println("processEvent : e="+e);
}
public void focusGained(FocusEvent e){System.out.println("FocusGained");}
public void focusLost(FocusEvent e){System.out.println("FocusLost");}
public void paint ( Graphics g ){
this.setBackground ( Color.blue );
}
public boolean isFocusTraversable() {
return true;
}
public boolean getFocusTraversalKeysEnabled() {
return false;
}
}


Thanks very much!
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcomt to JavaRanch.

There seem to be bugs in the Java Plugin that affect this - check the Java Bug database for #6463913 and #6456655.
 
stan Fish
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks so much for your information.
I have checked the Java bug database, it looks like #6463913 pretty match my problem. However, when I can't reproduce his problem. May be he already has a fix on it. I am wondering how he fixed it. Does anyone know any way to contact the bug writer? Thanks!!



Originally posted by Ulf Dittmer:
Welcomt to JavaRanch.

There seem to be bugs in the Java Plugin that affect this - check the Java Bug database for #6463913 and #6456655.

 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic