United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7129742 : Unable to view focus in Non-Editable TextArea

Details
Type:
Bug
Submit Date:
2012-01-13
Status:
Resolved
Updated Date:
2013-06-26
Project Name:
JDK
Resolved Date:
2012-05-09
Component:
client-libs
OS:
linux
Sub-Component:
javax.swing
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

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.
                                     
2012-01-17
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).
                                     
2012-01-16



Hardware and Software, Engineered to Work Together