JDK-8207039 : Wrong cursor position in JTextArea on HiDPI display with lineWrap = true
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 10.0.1
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: linux
  • CPU: x86_64
  • Submitted: 2018-06-29
  • Updated: 2018-07-31
  • Resolved: 2018-07-31
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
openSUSE Tumbleweed
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)


A DESCRIPTION OF THE PROBLEM :
Cursor in JTextArea is shifted when setLineWrap(true) on HiDPI display. I think this issue is related to JDK-8142966.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Create a sample with JTextArea which contains a log text and setLineWrap(true)
- Run the sample on HiDPI display or with -Dsun.java2d.uiScale=2 option
- Set a cursor in the middle of the text
The cursor position can be shifted from the char position 


FREQUENCY : always



Comments
Received an update from the submitter confirming that the issue does not occur with JDK 11. ========================================================= Test is in attachment. I run it on Linux machine with: GDK_SCALE=2 jdk-10/bin/java -classpath . Main then try to clink on the latest character (G) of then line with text. Cursor will be 6 characters left. See screenshot in attachment. Mouse cursor is on position where I clicked. Anyway I did test on jdk11 as you proposed and this problem is gone. ========================================================== Checked this for JDK 11 and 12 and confirmed that the issue does not occur here.
31-07-2018

Reported with JDK 10.0.1 in Linux, cursor in JTextArea is shifted when setLineWrap(true) on HiDPI display. The issue is marked related to JDK-8142966. Checked this with reported version in Windows 10 and Ubuntu 14.0.1 and couldn't verify the issue. Writing back to the submitter with results to provide additional details.
11-07-2018