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

JTextField scrolling behavior when entering Hebrew and English text.

    Details

      Description

      A DESCRIPTION OF THE PROBLEM :
      When the text entered into a JTextField exceeds the JTextField bounds, i.e. not all the text is visible, and the text contains both Hebrew and English text, there is character overlap. The Hebrew letters are painted over the English ones. The longer the text, the more overlap there is.

      REGRESSION : Last worked in version 8u172

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a stand-alone java Swing application that contains a JTextField. Make the JTextField large enough to display around 7 characters. Set the component orientation of the JTextField to RIGHT-TO-LEFT. Run the application. Start to enter English text into the JTextField. After entering three English characters, switch to Hebrew (or Arabic or any other right-to-left language) and start entering characters in that language. When the text length exceeds the width of the JTextField, the first Hebrew characters begin to overlap the last English characters.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      There should be no overlap of the characters.
      ACTUAL -
      The JTextField contents look as if a Hebrew letter was written over the top of an English letter.

      ---------- BEGIN SOURCE ----------
      public class Sscce {
          private static void main(String[] args) {
              java.awt.EventQueue.invokeLater(new Runnable() {
                  javax.swing.JFrame frame = new javax.swing.JFrame();
                  frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
                  javax.swing.JTextField tf = new javax.swing.JTextField(7);
                  tf.setComponentOrientation(java.awt.ComponentOrientation.RIGHT_TO_LEFT);
                  javax.swing.JPanel p = new javax.swing.JPanel();
                  p.add(tf);
                  frame.add(p);
                  frame.pack();
                  frame.setVisible(true);
              });
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Using a JTextArea wrapped in a JScrollPane where the number of rows in the JTextArea is one and the scrollbars of the JScrollPane are never shown.

      FREQUENCY : always


        Attachments

        1. Sscce.java
          0.7 kB
        2. TextDemo.java
          1 kB
        3. TextDemo.PNG
          TextDemo.PNG
          3 kB

          Issue Links

            Activity

              People

              • Assignee:
                dmarkov Dmitry Markov
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: