This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 37554 - ALT-TAB shifts focus to pulldown menus
Summary: ALT-TAB shifts focus to pulldown menus
Status: VERIFIED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: mslama
URL:
Keywords:
: 39450 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-11-26 23:13 UTC by _ gtzabari
Modified: 2008-12-22 23:58 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Simple test app (slightly modified MenuDemo from Java Swing tutorial) (6.86 KB, text/plain)
2004-01-21 16:56 UTC, mslama
Details
Log from Component.requestFocusHelper (4.27 KB, text/plain)
2004-01-22 08:22 UTC, mslama
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2003-11-26 23:13:37 UTC
dev build 200311241900

  When I hit ALT-TAB to switch to another window,
Netbeans thinks I'm hitting ALT for the pulldown
menus such that when I return to Netbeans the
focus is now in the pulldown menus. I expect it to
maintain the focus I had before hitting ALT-TAB to
change to another application.
Comment 1 mslama 2004-01-08 16:27:07 UTC
I will check. AFAIK Alt-TAB should be processed by OS and not posted
to application (NB in this case) at all.
Comment 2 mslama 2004-01-20 16:46:09 UTC
It works for me on JDK 1.4.2_01, Win XP, dev build from 19 Jan
200401191900. Alt-TAB switches among apps as usual. Any more info?
Comment 3 mslama 2004-01-20 16:47:20 UTC
I was in Explorer (focus on any tree node in Filesystems tab). Where
is focus in your case?
Comment 4 _ gtzabari 2004-01-21 02:44:53 UTC
I can reproduce the bug in dev build 200401111900 when my focus is in
EXPLORER and I hit ALT-TAB. The key to reproducing it is to hit
ALT-TAB very quickly. If you hit ALT+TAB, pause for a second, let go;
the focus will be fine. If you hit ALT+TAB quickly and let go almost
instantenously, the focus will be shifted to another app but Netbeans
will trigger the pulldown menu.

   If you pause one second, focus works fine. If you pause less than
100ms the problem occurs.
Comment 5 _ gtzabari 2004-01-21 02:45:25 UTC
Forgot to mention, I'm using JDK 1.4.2_03 under XP sp1.
Comment 6 mslama 2004-01-21 13:52:23 UTC
I tested now with JDK 1.4.2_03 and no success. I noticed when I press
Alt I see menu items in menu bar or more precisely their menmonic
chars are underlined. I believe only pressing Alt cannot invoke any
pull down menu from main menu. I tried to press TAB after Alt as fast
as I am able but I did not see any pulldown menu rolled down. I would
recommend to scan somehow what exactly key events are comming when you
press Alt-TAB. Are you sure your keyboard does not send anything
else???? I have no better explanation. Sorry. Is anybody else able to
reproduce this?

You could try simple Swing app (eg. menu example from Swing tutorial
and add logging of key events) to make sure no other events are generated.
Comment 7 mslama 2004-01-21 13:53:41 UTC
My NB dev build is from 19 Jan 2004. 200401191900
Comment 8 mslama 2004-01-21 13:56:48 UTC
Hmm you are right. I used all my hands and now focus is shifted to
File menu item in main menu. I will try to find where does this focus
transfer come from.
Comment 9 mslama 2004-01-21 15:58:51 UTC
Problem is simpler: If I have focus in for example editor and
press/release Alt key focus is trasnsferred to main menu. Again
press/release Alt focus goes back to editor. And again. Happens
always. I found that Windows RootPaneUI is processing Alt
pressed/released. This does not happens on Linux. Problem is that I am
not able to reproduce it with simple Swing menu demo with editable
area. You can avoid Alt-TAB, Alt is enough and you need not have fast
hands :).
Comment 10 mslama 2004-01-21 16:54:49 UTC
It is correct behaviour of Windows L&F. Please check behaviour of some
native Windows app. It is the same. So it is not bug but feature. If I
set L7F of my small test app to Windows eg using java
-Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel
MyApp it works like described.
Comment 11 mslama 2004-01-21 16:56:22 UTC
Created attachment 13008 [details]
Simple test app (slightly modified MenuDemo from Java Swing tutorial)
Comment 12 _ gtzabari 2004-01-21 19:08:12 UTC
Marek,

   While hitting and releasing ALT transfers focus from the
application to the menus and back is normal for any Windows app,
ALT-TAB never transfers focus to the menus in a native windows app
(I'm using Microsoft Outlook as reference).

   So in conclusion, my view is that this bug is still open and
furthermore it only occurs in Netbeans and not in any other native
windows application. Again, the bug is with "ALT-TAB", not with "ALT"
alone.

    After playing around with MenuDemo (which I modified to use the
native L&F) I believe this is a Windows L&F bug <sigh> I guess now I
have to wait 2 years before Sun fixes it :(

Thanks anyway,
Gili
Comment 13 mslama 2004-01-22 08:22:08 UTC
Ok I see. When I investigated I put log with call stack dump to
Component.requestFocusHelper(). WindowsRootPaneUI processes
altReleased, altPressed to emulate behaviour of native Win apps. When
you press Alt-TAB Alt pressed Alt released events are generated. You
can file issue against JDK. I attach log FYI.
Comment 14 mslama 2004-01-22 08:22:54 UTC
Created attachment 13018 [details]
Log from Component.requestFocusHelper
Comment 15 David Simonek 2004-01-22 10:21:06 UTC
Marku, would it be possible to file bug against JDK yourself? I't not
that time expensive. If so, then please add JDK bug number here in
comment. Thanks.
Comment 16 mslama 2004-01-22 15:48:32 UTC
I just tested latest JDK 1.5.0 build 33 (beta 2) and this problem does
not happen there.
Comment 17 _ gtzabari 2004-01-23 04:10:16 UTC
Marek,

  Is JDK 1.5 stable enough for daily use yet?

David,

  See related issues 4504821, 4161030, 4841881 (on Bug Parade). I've
also filed a separate bug report just in case (I don't have an
external bug ID yet).

   Specifically, bug id 4841881 seems to be identical to the one I
just filed but they closed it with "cannot reproduce". Hopefully this
is really fixed in JDK 1.5 (final).
Comment 18 _ gtzabari 2004-01-23 04:14:05 UTC
Marek,

   Is it possible to pass your log on to the Java team to work against
BugParade issue #4841881? Maybe this will help them reproduce the
problem or rule it as CLOSED-FIXED.
Comment 19 mslama 2004-01-27 09:57:17 UTC
Yes it is issue #4841881. In evaluation it is said that it is not
reproducible on any JDK 1.5 build. I could not reproduce it on JDK 1.5
build 33 (beta 2). So no need to file it again against JDK. Thanks for
your time.
Comment 20 Lukas Hasik 2004-02-03 09:38:25 UTC
*** Issue 39450 has been marked as a duplicate of this issue. ***
Comment 21 _ gtzabari 2004-02-05 17:08:35 UTC
Reproducible using dev build 200401301900, JDK 1.5.1 beta 1
Someone please reproduce it on another machine.
Comment 22 mslama 2004-04-16 13:41:31 UTC
I cannot reproduce it with JDK 1.5 beta 2 (build 47) and NB release 36.
>System Info: 
  Product Version       = NetBeans IDE 3.6 (Build 200404071636)
  Operating System      = Windows XP version 5.1 running on x86
  Java; VM; Vendor      = 1.5.0-beta2; Java HotSpot(TM) Client VM
1.5.0-beta2-b47; Sun Microsystems Inc.

I tried many times to press Alt-TAB quickly and focus stays where it
was before (either editor or explorer). The same way worked with JDK
1.4.2_x ie. I was able to reproduce this focus move to menu.

But if I press and release only Alt key in NB focus is moved to menu
when Alt key is released. Press and release Alt again and focus goes
back. So it might be some weird key combination in your case.

In test I press quickly first Alt and then TAB. I release both. Now
next app is activated and focus is NOT in menu in NB window. (I
arranged apps so that I can see NB window even if other app window is
activated.)

Closing this issue.
Comment 23 _ gtzabari 2004-04-16 16:32:42 UTC
I will verify once beta 2 comes out. When is it being released to the
public?
Comment 24 mslama 2004-04-16 16:36:49 UTC
I do not know if there is any official date. I can just recommend to
check java.sun.com regularly.
Comment 25 David Konecny 2004-04-18 12:49:14 UTC
I also suffer from this problem and can verify that it works fine on
1.5.0-beta2.