JDK-6532781 : default focus is not there on the window when parent frame is iconified.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-03-09
  • Updated: 2011-04-29
Related Reports
Relates :  
Description
1.Create a frame
2.setExtendedState of the frame to Iconfied.
3.and make it visible.
4.Create a Window as a child of the frame. with a focusable button.
5.make the window visible.

Expected result: button in the window should have the focus.
Actual result: Button in the frame is not gaining the focus when the parent is in minimised state.

Run the attached test to reproduce the defect.

This defect exists in Windows since 5.0, i tried the same thing on dialog it works fine.

Comments
EVALUATION When the owned is not shown on the screen its owned window can't be focused. This follows from the javadoc: ------------------------ Window.isFocusableWindow <...>For a Window which is not a Frame or Dialog to be focusable, its focusable Window state must be set to true, its nearest owning Frame or Dialog must be showing on the screen, and <...> ------------------------ Also, I've found that the Window.isFocusableWindow() returns true after the Window is shown in the testcase. This should also be fixed.
15-03-2007

EVALUATION When I press the button in the window, it is repainted as if it had focus. However, no key events are sent to it by Windows (I have verified this with Spy++). I think the best way to fix this problem is to restore the parent frame when its child window is shown or minimize the window if its parent is iconified.
09-03-2007