JDK-6684528 : keyevents are lost in new window
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0u14
  • Priority: P2
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows
  • CPU: x86
  • Submitted: 2008-04-04
  • Updated: 2011-02-16
  • Resolved: 2008-05-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
5.0-poolResolved 6-poolResolved
Related Reports
Relates :  
Description
This is IBIS case 70175950
Customer is migrating from MSJVM to Sun JVM.
It works with MSJVM, but not with Sun's JVM (5u14)

To reproduce:
download the attachment: Verizon.dll, KbdAccess.dll, suntest.zip

1.Extract the contents of the zip file to C:
2.This will create a directory c:\Discovere\bin
  Please note:
  All the files need to be extracted to c:\
  Please also put KbdAccess.dll + Verison.dll into
  c:\windows\system32\
3.Set classpath to include ows.jar that would be located in the bin
  directory
4.Run java ows.loader.OWSMain
  java -cp c:\Discovere\bin\ows.jar -verbose ows.loader.OWSMain
5.Type the home key on the keyboard and that should open a poppup
6.After this point there is no focus on this window and all keyevents.
  C (copy) V (paste) T (cut) not response
7.The jar file also includes source if you are interested in looking
  further.

Comments
EVALUATION I have run customer's code and here are a few observations: - Customer is creating a popup menu (ows.sharemenu.GeneralMenu) using java.awt.Window object - The parent of the object is an awt Frame which is visible. So far so good. - Interestingly all the components in the cu's Window container are Label components which are "not focusable" by default. These are the wordings in awt focus spec: http://java.sun.com/j2se/1.5.0/docs/api/java/awt/doc-files/FocusSpec.html "Every Window which is not a Frame or Dialog, but whose nearest owning Frame or Dialog is showing on the screen, and which has at least one Component in its focus traversal cycle, is also focusable by default. " Since customer's container contains only Label(s) and a panel (none of which are focusable by default), the window is not focusable and hence adding keylistener to the Window object has no effect. Hence this is not a bug in jdk code and is infact an expected behaviour as per the spec. The popupmenu in cu's app contains over 20 Label components and so making each of them focusable and adding keylisteners to them wouldn't be a good design. There are two solutions for the customer to try out: 1. Call Window.setFocusable(true) 2. or reset the focus traversal policy of the window to ContainerOrderFocusTraversalPolicy. The first one is much simpler I believe. I have added one line code(pt. 1 above) to the customer's application and the popupmenu behaves as expected.
09-04-2008