JDK-8212767 : JTextField scrolling behavior when entering Hebrew and English text.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u181
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2018-10-17
  • Updated: 2019-01-17
  • Resolved: 2018-11-28
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 8
8-poolResolved
Related Reports
Duplicate :  
Relates :  
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



Comments
The necessary fixes were ported to JDK 8 u. Closing this one as dupe of JDK-8076164
28-11-2018

The issue was fixed in JDK 9 by JDK-8076164. So it has to be ported to JDK 8. BTW, JDK-8076164 caused several regression. So it is necessary to back-port the following fixes, as well: JDK-8132136, JDK-8133108 and JDK-8133731
16-11-2018

I can reproduce the problem using the following steps: - Run the attached test case with respective JDK versions. - Enter some English text into the JTextField, say 3 to 4 characters. - Change to Hebrew or any other RTL language - Continue entering text (20-25 characters). As the text exceeds the JTextField bounds, the initial Hebrew characters will start overlapping the last English characters. Scroll to right to identify. The problem is reproducible on 8u181, 8u172, 8 and 7. So it shouldn���t be considered as regression. I am removing ���regression��� label. Also the problem does not take place on 9, 10, 12.
15-11-2018

As per description text composed of English and Hebrew (in same order) when entered in JTextField and exceeds the JTextField bounds, the Hebrew characters gets overlapped by the English. Provided test case was incomplete, therefore verified with modified test case (attached) and could confirm the issue with reported versions. This is a regression in JDK 8u181 a it works fine with JDK 9 and above versions. Results: ========= 8: OK 8u172: OK 8u181: Fail 8u191: Fail 9: OK 12 ea b14: OK To verify, - Run the attached test case with respective JDK versions. - Enter some English text into the JTextField, say 3 to 4 characters. - Change to Hebrew or any other RTL language - As the text exceeds the JTextField bounds, the initial Hebrew characters overlap the last English characters.
22-10-2018