JDK-8073453 : Focus doesn't move when pressing Shift + Tab keys
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-02-19
  • Updated: 2015-09-29
  • Resolved: 2015-04-14
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 7 JDK 8 JDK 9
7u85Fixed 8u60Fixed 9 b65Fixed
Description
Symptom:
From jdk7, pressing Shift + Tab doesn't move focus sometimes at AWT 
application which uses FocusTraversalPolicyProvider.
This problem can not be seen with jdk6.

Environment:
OS : Windows 7 64 bits
JDK: jdk7

To reproduce:
1. Compile the attached TP Sample.java and launch it with jdk7(java Sample)
2. Press Tab key to move focus from TextField to Button
3. Press Shift + Tab to move focus back from Button to TextField
4. Press Shift + Tab to move focus from TextField to Button but focus never 
shift


Comments
Problem description: The method ContainerOrderFocusTraversalPolicy.getLastComponent() always returns null if the last component is a container with focus traversal policy and does not have any sub-components. In some cases such behaviour of getLastComponent() causes failure during reverse focus transition, (i.e. focus stays on the selected component when SHIFT+TAB is pressed). Fix: If the last component is a container with focus traversal policy and does not have any sub-components, the method getLastComponent() should return a previous component instead of null. Please note: the same approach is already implemented for ContainerOrderFocusTraversalPolicy.getFirstComponent().
06-04-2015

Test case attached.
06-04-2015