Ok, I have been struggling with this for a couple of weeks off and on. I asked a similar question 2 weeks ago in the Applet forum and got little to no help. So here goes in the Swing forum: I have a JApplet with some JTextFields. I am running JDK1.4.1_01 on XP and JRE 1.4.1_01 in IE 6.0. The tab keys do not work in traversing to the next component. I even went as far as disabling the key traversal and writing my own KeyEvent to handle the tab key. I can't even get it to recognize the fact that I am hitting the tab key. I have a simple Print statement to tell me when I hit TAB and nothing ever prints. When this is in an Application Form, it works perfectly. Does anyone know if this is a Bug and if there is a work around? I really need the tab to work.
Well, I have narrowed the problem down to an actual bug in the JVM. Here is a link to it: Bug Database According to them, this issue has been fixed. But it hasn't. Also, on a related bug, they say it works fine in j2sdk1.4.2. Must be nice to be able to install a JDK release that isn't available yet and say everything is fixed. That doesn't help people that need it to work now. The solution is you have to setTraversableCycleRoot(true) on the JApplet root container. Then you have to setFocusable(true) on every component you need to tab to. This is a workaround and does work. However, there is still a problem. When creating my own KeyListener I was trying to capture the Tab KeyEvent.VK_TAB. This still doesn't work. In doing this, I noticed that hitting ENTER, SPACE, and TAB all give the same KeyEvent Integer of 0 for some reason. So they are not registering themselves correctly or something. Anyway, just wanted to give an update as to the information I have found our regarding this problem.