JDK-7129742 : Unable to view focus in Non-Editable TextArea
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2012-01-13
  • Updated: 2013-06-26
  • Resolved: 2012-05-09
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
7u40Fixed 8 b38Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) Client VM (build 21.1-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Linux  2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
On Linux, when the TextArea instance is set to non-editable, it does not show a caret when it is focused. This will confuse users. On windows, the focus is visible.

This is reported to java.awt.TextArea .

// I reported http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7119745 , but it was closed, so I update the description and testcase a little and report it again. This problem is definitely NOT swing.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the testcase with jdk7.
2. Press tab to move the focus to TextArea


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
When Focus goes to TextArea, it should be visible.
ACTUAL -
The focus is not visible.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.TextArea;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class OJDK103 {

    public static void main(String[] str) {
        JFrame jf = new JFrame();
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JButton jb = new JButton("click");
        JPanel jp = new JPanel();
        jf.setSize(200, 200);
        
        jf.getContentPane().add(jp);
        jp.add(jb);
        
        TextArea ta = new TextArea(6, 10);
        ta.setText("Text Area");
        ta.setEditable(false);
        jp.add(ta);
        
        jf.setVisible(true);
    }
}

---------- END SOURCE ----------

Comments
EVALUATION Retargetting to Swing team because of detalis of implementation of XToolkit TextField component.
17-01-2012

EVALUATION Patch provided at http://cr.openjdk.java.net/~zhouyx/7129742/webrev.00/ (see http://mail.openjdk.java.net/pipermail/awt-dev/2012-January/002148.html).
16-01-2012