JDK-8076164 : [JTextField] When input too long Thai character, cursor's behavior is odd
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u25,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2015-03-26
  • Updated: 2019-03-19
  • Resolved: 2015-07-14
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 JDK 9 Other
8u211Fixed 9 b76Fixed openjdk8u212Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) Client VM (build 25.25-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
ver : Window 7 Pro,  64bit, 


A DESCRIPTION OF THE PROBLEM :
When Input too long Thailand characters(Must Include space) in JTextField and exceed its display size, we found the cursor's behavior is odd while moving the cursor.

 The cursor will not locate at between two Thai character, but in the middle of one single Thai character.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.  Create a  simple JTextField
2.  Input long Thai language wording (*Must With space in it)
      Exceed JTextField's display size
      Thai:  ���������������������������������������������������������������������        ������������������������������������������������������������     ���������������������������������������������    ������������������������������������������������������������������������������
3.  Move the cursor to the end of JTextField using keyboard "->"
4.  Move cursor back using keyboard "<-"
5.  Then I found that, the cursor will locate at middle of one Thai character, and the characters behind the cursor will disappear.

6. At this time, if we clear all Thai characters, and input Chinese, then try steps 3 and 4, there will be similar issue.

* But if we re-compile and run the application again, Just input longer Chinese , it has no this issue.  Seems something wrong with the Thai input.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Whenever input longer Thai character and move the cursor, the display and behavior is right.
ACTUAL -
 the cursor will locate at middle of one Thai character, and the characters behind the cursor will disappear.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No any error

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class TestTexts extends JFrame{

	private JLabel label = new JLabel("Status");
	private JTextField textField;
	private JPasswordField pwdField;
	private JTextArea textArea;
	private JFormattedTextField fField;

	public TestTexts() {
		super("Test Texts");
		this.pack();
		
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		getContentPane().setLayout(new java.awt.FlowLayout());

		textField = new JTextField(15);
		

		

		getContentPane().add(textField);

		setSize(200, 200);
	}
	
	public static void main(String[] args) {
		
		SwingUtilities.invokeLater(new Runnable() {
	          
	           @Override
	           public void run() {
	              new TestTexts().show();
	           }
	       });
	}
}
---------- END SOURCE ----------


Comments
Fix Request Patch applies cleanly, includes its own test.
27-02-2019

Once typing any Thai text it breaks the JTextField text scrolling forever.
30-03-2015