JDK-4397883 : Focus goes nowhere when the InputMethodWindow (focusable = false) is created
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2000-12-13
  • Updated: 2001-05-03
  • Resolved: 2001-04-04
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.
Other
1.4.0 betaFixed
Related Reports
Relates :  
Description
When an InputMethodWindow is created with which setFocusableWindow(false) is called, an extra focusLost event is delivered to the main frame window and the focus itself goes nowhere.  To reproduce, compile and run the attached test case and then:

1) Press TAB key some times, then you can see that the focus is at either of those buttons in main frame window.
2) Click on the button named "IMWindow w/o calling setFocusableWindow(false)", then an InputMethodWindow appears.
3) Press TAB key some times, then you can still see that the focus is at either of those buttons.
4) Click on the button named "IMWindow w/ calling setFocusableWindow(false)", then another InputMethodWindow appears.  This window is set to un-focusable state.
4) Press TAB key some times, but you will notice that the focus is gone somewhere outside of the main frame window.

Expected result: Even if the InputMethodWindow is set to un-focusable, creating that window should not affect the focus on the main window.  This is preventing us from adding setFocusableWindow(false) call in InputMethodWindow.

naoto.sato@Eng 2000-12-13

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta FIXED IN: merlin-beta INTEGRATED IN: merlin-beta VERIFIED IN: merlin-beta
14-06-2004

EVALUATION I'm committing this to merlin-beta, since the comments say it is holding up work on a merlin feature. eric.hawkes@eng 2001-03-14 Name: pzR10082 Date: 03/22/2001 Here's what happens: * Window.setFocusableWindow(false) is called; * This method determines the owner of the window and its MostRecentFocusOwner; * If MostRecentFocusOwner is not null, it tries to set focus on it; * If the attempt to set focus fails, clearGlobalFocusOwner() is called. In our case MostRecentFocusOwner is the button that currently has focus (i.e. the focus owner), so calling requestFocus() on it returns false, as specified in method Component.requestFocusHelper(). This is why focus owner gets cleared. What i suppose is wrong here: * Window.setFocusableWindow() tries to change focus owner. This is OK when the window is showing. But is there a reason to do so if the window is invisible? * I'm not sure what requestFocus() should return when called on currently focused component. The doc says a return value of false indicates that 'request is guaranteed to fail'; however, what happens in this case doesn't look like a 'failure'. Maybe the javadoc should be more clear about this. * (this is unrelated to the bug) Javadoc for method Window.setFocusableWindow() says 'If this method returns false...' This method doesn't return anything. ###@###.### 2001-03-22 ====================================================================== Name: pzR10082 Date: 03/26/2001 Window.setFocusableWindow() should try to change the focus owner only if Window.isFocused() returns true. This fixes the case of non-focusable Windows. However on Solaris, when a non-focusable Frame pops up, it becomes active, and both focused window and focus owner become null. I'm not sure whether this is correct or not. If it turns out to be a bug, i'll update the report with the bug number. ###@###.### 2001-03-26 ======================================================================
26-03-2001

SUGGESTED FIX Name: pzR10082 Date: 03/26/2001 *** /tmp/geta838 Mon Mar 26 10:08:09 2001 --- Window.java Mon Mar 26 10:04:24 2001 *************** *** 1234,1240 **** } firePropertyChange("focusableWindow", oldFocusableWindow, focusableWindow); ! if (oldFocusableWindow && !focusableWindow) { for (Window owner = (Window)getParent(); owner != null; owner = (Window)owner.getParent()) --- 1234,1240 ---- } firePropertyChange("focusableWindow", oldFocusableWindow, focusableWindow); ! if (oldFocusableWindow && !focusableWindow && isFocused()) { for (Window owner = (Window)getParent(); owner != null; owner = (Window)owner.getParent()) ###@###.### 2001-03-26 ======================================================================
26-03-2001