JDK-6692619 : Component is missing after changing the z-order of the component & focus is not transfered in
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u10
  • Priority: P1
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-04-23
  • Updated: 2011-01-19
  • Resolved: 2008-04-26
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.
JDK 6 JDK 7
6u10 b23Fixed 7Fixed
Related Reports
Relates :  
Description
I have a jframe which contains 4 buttons. I change the make the first button as the focus owner & change the z-order of the 2nd button, the component is shifted i,e z-order is applied but a component is remove or hidden . After i am pressing tab to change the focus , but focus is not transfered. This works fine in 6u10_b22 promoted build, fails in 6u10 b23 pit only. This is the regression of http://monaco.sfbay.sun.com/detail.jsf?cr=6616323-2161436. Hence its a regression introduced in pit build.  I have the screen shot of same .

Step to reproduce:-
---------------------
1) Run the attached program . This is an automated testcase.
2) Observe that after the z-order ( b1 is changing its position ) b3 is  missing & focus remains on b1 . If you see the same then the bug is reproduced.
This bug is reproduced also for awt components with the 6u10 b23 pit build.
However the component is not getting missed but the focus is not transferred to the 
required component after changing the ZOrder. 
getComponentZOrder(Component comp) method is not returing the proper ZOrder index of the component
after changing the ZOrder .

Steps to reproduce:

1. Run the attached automated testcase (ZOrder.java) 
2. Observe that after changing the ZOrder the focus is not transferred to the required component (After pressing tab)
3. Also observe that getComponentZOrder(Component comp) method is returing unexpected values.

Since this is a regression I am increasing the priority .

Comments
EVALUATION When removing the component delicately there is some additional check exists: if (newIndex > index) { newIndex--; } Which were introduced while fixing 6616323 by mistake which is described in the comment just above that extra check: // If we first remove a component before adding it into higher index (newIndex), // then newIndex should be decremented. But there are also several examples that contradict that statement: // 2->4: 012345 -> 013425, 2->5: 012345 -> 013452 // 4->2: 012345 -> 014235 So far, even we shift the components left by one position when removing particular element, it's still ok to push it by the newIndex without decrement.
23-04-2008

SUGGESTED FIX I'm about to add a note about this into the code: // According to the rules below we should remove component and then // add it by the newIndex without newIndex decrement if even we shift components to the left // after remove. // 2->4: 012345 -> 013425, 2->5: 012345 -> 013452 // 4->2: 012345 -> 014235
23-04-2008