JDK-4915473 : Focus does not move from one to another internalFrame when pulldown menu is open
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-09-01
  • Updated: 2003-11-20
  • Resolved: 2003-11-20
Related Reports
Duplicate :  
Description
Two InternalFrames show up.
When we input some characters in one InternalFrame and open the pull down
menu. Then we click another internalFrame to move the focus and input 
characters,  the characters does not appear in the latter internalFrame.
Those shows up in the former internalFrame.
This seems that the focus does not move when pull down menu stay open.

REPRODUCE:
 1) Compile the attached test programs.
 2) Invoke "Java TestFrame"

    Although we can see only one InternalFrame, this program shows 
    2 InternalFrames.
    One is "InternalFrame1". another is "InternalFrame2" behind the
    InternalFrame1.

 3) Move the "InternalFrame1" in order to show InternalFrame2.
 4) Press some key and you will see a character which you input.
 5) Click "menu" in InternalFrame1
 6) Click InternalFrame2 while the menu in InternalFrame1 stays open.
 7) Press some key

 Problem: 
   We expect that the character appears in the InternalFrame2,
   but it does in InternalFrame1.
   This does not seem that the focus does not move correctly while
   menu is opening.


CONFIGRATION:
 OS  : WindowsXP(SP1, Japanese)
 JRE : 1.4.1_05/1.4.2fcs/1.5b17



NOTE:
 The followings are the report from the user.

===>
We tracked the program flow in the test program.

Usually the focus moves from Frame1 to Frame2,

 Mouse click  -> evevt occurs -> draw something in Frame2 
 -> execute internalFrameActivated()

However, when the menu in InternalFrame1 is opening,
the program flows,

 Mouse click  -> evevt occurs -> draw something in Frame2 
 -> execute internalFrameActivated()
 -> Close Frame1

As to the "close Frame1", we found the code in
 javax.swing.plaf.basic.BasicPopupMenuUI$MenuKeyboardHelper.removeItems.

        if (lastFocused != null) {
                        lastFocused.requestFocus();
        }

The lastFocuses has the Object which had the focus just before the menu in 
internalFrame1 was opened.(which is, Jpanel in Frame1)

We cosider the following scenario.

In the above "close Frame1", the program retrieves the focus again 
which once moves to Jpanell of Frame2.

<=======


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




Comments
EVALUATION Looks like popup problem. ###@###.### 2003-09-03 Name: azR10139 Date: 11/20/2003 The bug is caused by the same reasons as bug 4912806: 1.5.0 Regression: Showing JPopupMenu prevents double clicking on JButton With this fix everything works as expected. ###@###.### 11/20/2003 ======================================================================
20-11-2003