Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7119745

Unable to view focus in Non-Editable TextArea

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 7
    • client-libs

      FULL PRODUCT VERSION :
      Ijava 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 :

      When the TextArea instance is set to non-editable, it does not show a caret when it is focused. This will confuse users.

      There is a bug reported to JTextArea for many years.

      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 -
      A caret is showing to indicate it has the focus.
      ACTUAL -
      No caret is showing.

      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;
      import javax.swing.JTextArea;

      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);
              JTextArea jt = new JTextArea(3, 3);
              jf.getContentPane().add(jp);
              jp.add(jb);
              jp.add(jt);
              jf.setVisible(true);
              jt.setText("hello how r u");
              jt.setEditable(false);
              TextArea ta = new TextArea(6, 10);
              ta.setText("Rajesh kumar");
              ta.setEditable(false);
              jp.add(ta);
          }

      }
      ---------- END SOURCE ----------

            alexp Alexander Potochkin (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: