JDK-6547951 : On MAWT TextArea, cursor keeps blinking after focus moved to a native window.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2007-04-19
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
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.
6u4Fixed 7 b14Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Reproduced on Redhat Enterprise Linux 4 (Update 4) with 1.6.0-b105.

On MAWT TextArea or TextField, cursor keeps blinking after focus moved to a native window.

Test instruction is as follows:
1. Compile and launch the sample code with MToolkit.
$ javac TextAreaTest
$ AWT_TOOLKIT=MToolkit java TextAreaTest
=> Two TextArea components will appear.

2. Move focus to "TextArea 1".

3. Move focus to another native window, like terminal.
=> Cursor is still blinking. <= Problem.

4. Move focus from the native window to "TextArea 2".
=> Both TextArea 1 and 2 show blinking cursor.  <= Problem.

Expected result:
Cursor should be pale color and stop blinking, after focus loses.

Focus change between these TextArea components, it works as expectedly.

Additional Information:
Motif's text widget doesn't get FocusOut event.

The problem didn't occur on Java5. It introduced from Java6.

======== TextAreaTest.java ====================================
import java.awt.*;
public class TextAreaTest {
        public TextAreaTest(String title) {
                Frame frame = new Frame(title);
                frame.add(new TextArea());
                frame.setSize(300, 100);
        public static void main(String[] args) {
                TextAreaTest t1=new TextAreaTest("TextArea 1");
                TextAreaTest t2=new TextAreaTest("TextArea 2");

SUGGESTED FIX /net/jano.sfbay/export/disk26/awt/ws/7/j2se

EVALUATION I'm reopening the issue by the following: 1. The requestor kindly asked us to fix it if possible; 2. I've managed to fix it quite soon. The fix is easy. In the motif code, when a widget looses focus we call for XtSetKeyboardFocus(shell, NULL) to reset it for the widget. However we do it under the condition of transfering focus to another Java window. I can't see the reason of this limitation and so I suppose we should expand the condition to any opposite window.

EVALUATION This problem is not reproducible with XToolkit, so I'm closing it as will not fix. If anyone needs this to be fixed for MToolkit, as escalation should be filed.

EVALUATION I don't see any involvement of the input methods here and it looks like an AWT focus issue. Transferring to the AWT.