JDK-8163124 : On HiDPI display text width can have floating point value so there should be a way to set the caret to floating point position: add floating point API support to javax.swing.text.Caret
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • Submitted: 2016-08-03
  • Updated: 2017-10-31
  • Resolved: 2017-10-31
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 10
10Resolved
Related Reports
Relates :  
Relates :  
Description
The following methods in javax.swing.text.Caret interface use integer coordinates:
void setMagicCaretPosition(Point p)
Point getMagicCaretPosition()

On HiDPI display text width can have floating point value so there should be a way to set the caret to floating point position.
Comments
Testing with already introduced testcase javax/swing/text/Caret/8163124/CaretFloatingPointAPITest.java I could not reproduce any caret position problem in jdk10 with uiScale > 1
31-10-2017

Targeted to 10 as an issue introduced in 8u or 9
17-02-2017

Approved by component triage team to defer
02-12-2016

SQE: JDK 9: OK to defer
02-12-2016

Deffer request: The rounding of the floating point caret position for the moving to new line can cause problems in only under special conditions like a font size is very small and the UI scale is very large (like font is Dialog plain with size 2 and UI scale is 32) For more details see: http://mail.openjdk.java.net/pipermail/swing-dev/2016-September/006706.html
01-12-2016

the remaining work to be done: The fix is on the review: http://mail.openjdk.java.net/pipermail/swing-dev/2016-August/006450.html the risk level: low justification: the new API allows to properly draw a Swing caret on HiDPI displays. best estimate of the date by which the feature will be complete: 30 of August. But it really depends on the review.
06-09-2016

This is a tweak (potential bug), but not an enhancement.
06-09-2016

The proposed fix: http://cr.openjdk.java.net/~alexsch/8163124/webrev.00/ The review thread: http://mail.openjdk.java.net/pipermail/swing-dev/2016-August/006450.html
04-08-2016

The following public methods will be added: javax.swing.text.Caret.getMagicCaretPosition2D() javax.swing.text.Caret.setMagicCaretPosition2D(Point2D p) javax.swing.text.JTextComponent.modelToView2D(int pos) javax.swing.text.JTextComponent.viewToModel2D(Point2D pt) javax.swing.text.ParagraphView.getClosestPositionTo(int pos, Position.Bias b, Shape a, int direction, Position.Bias[], int rowIndex, float x)
04-08-2016