United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4172991 : Win32 PLAF: Alt key must be pressed twice for focus toggle

Details
Type:
Bug
Submit Date:
1998-09-11
Status:
Closed
Updated Date:
2003-01-29
Project Name:
JDK
Resolved Date:
2002-12-03
Component:
client-libs
OS:
windows_nt,windows_98,windows_2000
Sub-Component:
javax.swing
CPU:
x86
Priority:
P4
Resolution:
Cannot Reproduce
Affected Versions:
1.2.0,1.4.0,1.4.1
Fixed Versions:

Related Reports
Duplicate:
Duplicate:
Relates:

Sub Tasks

Description
Name: diC59631			Date: 09/11/98

Under Win32, you can press and release the Alt key to go to the first item in the pulldown menu.  When you press and release it again, focus returns to the widget it was previously in.

In the Swing Win32 look and feel, pressing Alt is  not caught by Swing. Instead, keyboard focus moves to the Windows's system box (in the upper left corner of the window-this is controlled by windows) and the user gets no feedback at all to where his keyboard focus has vanished.

I'm reporting this for Swing 1.1b2 running on JDK 1.1.6
(Review ID: 38593)
======================================================================

###@###.### 2002-05-20

Name: as83306			Date: 05/16/2002

Regression test javax/swing/JPopupMenu/PopupTest/MenuTester.java fails with Hopper-b11, windows_2000-server, host-metamorphic, hotspot-server, JVM-32bit, desktop-active.  

 For test hardware config's, see http://sqesvr.eng/st3/jdk1.4/docs/Merlin-hw.html
#Test Results (version 2)
#Thu May 09 02:02:47 PDT 2002
#checksum:367b18c503c6f661
#-----testdescription-----
$file=C:\\regression\\hopper\\jdk1.4.1Tests\\tests\\b11\\javax\\swing\\JPopupMenu\\PopupTest\\MenuTester.java
$root=C:\\regression\\hopper\\jdk1.4.1Tests\\tests\\b11
author=Peter Zhelezniakov
keywords=bug4213634 bug4503016
run=USER_SPECIFIED build Driver Log MenuTester Robot TestCase TestFailedException TestMenu TestMenuItem Verifier\r\nUSER_SPECIFIED 
main/timeout=900 MenuTester\r\n
source=MenuTester.java
title= 

#-----environment-----

#-----testresult-----
description=file:///C:/regression/hopper/jdk1.4.1Tests/tests/b11/javax/swing/JPopupMenu/PopupTest/MenuTester.java
end=Thu May 09 02:02:47 PDT 2002
environment=regtest
execStatus=Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Some test cases failed
javatestOS=Windows 2000 5.0 (x86)
javatestVersion=2.1.5
script=com.sun.javatest.regtest.RegressionScript 
sections=script_messages build compile compile build main
start=Thu May 09 02:02:31 PDT 2002
status=Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Some test cases failed
test=javax/swing/JPopupMenu/PopupTest/MenuTester.java
work=C:\\results\\regression\\hopper\\b11\\METAMORPHIC-Windows_NT-jth13-jdk141b11.05-08.21-20-ALL\\javax\\swing\\JPopupMenu\\Popup
Test

#section:script_messages
----------messages:(4/200)----------
JDK under test: (C:/Java/jdk141b11)
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b11)
Java HotSpot(TM) Server VM (build 1.4.1-beta-b11, mixed mode)

#section:build
----------messages:(3/188)----------
command: build Verifier 
reason: User specified action: run build Driver Log MenuTester Robot TestCase TestFailedException TestMenu TestMenuItem Verifier 
elapsed time (seconds): 6.009
result: Passed. No need to compile: Verifier.java

#section:compile
----------messages:(3/201)*----------
command: compile C:\\regression\\hopper\\jdk1.4.1Tests\\tests\\b11\\javax\\swing\\JPopupMenu\\PopupTest\\Driver.java 
reason: .class file out of date or does not exist
elapsed time (seconds): 2.935
----------System.out:(0/0)----------
----------System.err:(0/0)----------
result: Passed. Compilation successful

#section:compile
----------messages:(3/205)*----------
command: compile C:\\regression\\hopper\\jdk1.4.1Tests\\tests\\b11\\javax\\swing\\JPopupMenu\\PopupTest\\MenuTester.java 
reason: .class file out of date or does not exist
elapsed time (seconds): 3.054
----------System.out:(0/0)----------
----------System.err:(0/0)----------
result: Passed. Compilation successful

#section:build
----------messages:(3/97)----------
command: build MenuTester 
reason: Named class compiled on demand
elapsed time (seconds): 0.0
result: Passed. No need to compile: MenuTester.java

#section:main
----------messages:(3/122)----------
command: main MenuTester
reason: User specified action: run main/timeout=900 MenuTester 
elapsed time (seconds): 9.153
----------System.out:(0/0)----------
----------System.err:(17/916)----------
To rerun failed testcases, run:
java MenuTester tcEmptyMenu tc4213634 tc4503016 tcWin2kAltTest 
java.lang.RuntimeException: Some test cases failed
	at MenuTester.report(MenuTester.java:336)
	at MenuTester.test(MenuTester.java:305)
	at MenuTester.main(MenuTester.java:342)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:536)

JavaTest Message: Test threw exception: java.lang.RuntimeException: Some test cases failed
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.RuntimeException: Some test cases failed
result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Some test cases failed

test result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Some test cases failed
======================================================================

                                    

Comments
EVALUATION

This has been (mostly) fixed in 1.4.1 b11 under the bug id 4486301. Using my test case under Windows NT, I have to press the ALT key twice to get it to toggle focus between the first JMenu of the JMenuBar and the current focusable component. 

In order to be like Windows, the ALT key should only be pressed once. Perhaps this is fine under Win 2K but I don't have a copy of Win 2K conveniently located.

I've changed the synopsis line and reassinged to the engineer who really understands this code.
###@###.### 2002-05-16

Alt key handler in Swing is implemented as a KeyEventPostProcessor. Currently postprocessors receive events after they are handled by Windows, so there's no way to intercept Alt press and release events before Windows has seen them. Part of the solution is to make sure postprocessors are notified of an event before it is handled by OS. This should be done on AWT side. Then on Swing side we should consume those events we don't want Windows to receive.
###@###.### 2002-06-06

Name: osR10079			Date: 06/11/2002

i've filed separate bug (4700276) against AWT-part of this
problem. As soon as we fix it, we'll reassign this bug back to swing.
###@###.###  June 11, 2002


======================================================================

Name: osR10079			Date: 06/18/2002

4700276 was fixed thus i reassign this bug back to Swing
to fix Swing's part of this bug.
###@###.###  June 19, 2002
======================================================================

Name: pzR10082			Date: 12/03/2002


This has been fixed in 1.4.2. Fix for bug 4736093 has also fixed this bug.

###@###.### 

======================================================================
                                     
2004-08-24



Hardware and Software, Engineered to Work Together