JDK-8125356 : FXML-LoginDemo text field doesn't show characters
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2012-11-13
  • Updated: 2015-06-17
  • Resolved: 2012-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
8Fixed
Related Reports
Duplicate :  
Relates :  
Description
Login and click on address or phone number.  Type any character.  Characters are not shown except when another field is clicked.

This is also seen in Ensemble's search field.  Often reproducible using these steps:
highlight text field, delete, then start typing.
Comments
Changeset: http://hg.openjdk.java.net/openjfx/8/controls/rt/rev/b354819486c6
28-11-2012

Note: This problem happens when deleteNextChar() is executed. Because the change happens entirely after the caret mark the selectRange(int,int) is not called. If selectRange() had been called, it would have fired TextField#caretPosition changed->Text#caretPosition changed->Text#caretShape changed->TextFieldSkin#CaretPath update.
15-11-2012

RT-23074 will deal with caret bias in text controls.
14-11-2012

IMO this is bug in TextFieldSkin that has recently being exposed by changes I made to Text. In Text, if the text changes the selection start and selection end offsets are unset. The caret position is a offset just like selection start and selection end, so I change the code in text to unset caret position and caret bias when the text changes (consistent with selection start and end). Note that in TextFieldSkin#updateSelection() is called when the selection changes in the textfield and also when selection shape changed in the text node. This method always updates the selection start and selection end before retrieving the selection shape back for the text node. For caret position the same strategy is not used. Since caret bias is not handled at all in TextFieldSkin, and since that will be necessary to support bidi text, I believe the long term goal is to fix TextFieldSkin to handle caret position and caret bias with more care. In the short term we can, change Text, as follow: diff -r 6948b1cc29c5 javafx-ui-common/src/javafx/scene/text/Text.java --- a/javafx-ui-common/src/javafx/scene/text/Text.java Wed Nov 14 10:54:40 2012 -0800 +++ b/javafx-ui-common/src/javafx/scene/text/Text.java Wed Nov 14 15:07:43 2012 -0800 @@ -364,8 +364,9 @@ needsFullTextLayout(); setImpl_selectionStart(-1); setImpl_selectionEnd(-1); - setImpl_caretPosition(-1); - setImpl_caretBias(true); + // bad bad TextFieldSkin +// setImpl_caretPosition(-1); +// setImpl_caretBias(true); Or fix TextFieldSkin a little bit: diff -r 6948b1cc29c5 javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextFieldSkin.java --- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextFieldSkin.java Wed Nov 14 10:54:40 2012 -0800 +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextFieldSkin.java Wed Nov 14 15:10:47 2012 -0800 @@ -297,6 +297,8 @@ caretPath.layoutYProperty().bind(textTranslateY); textNode.impl_caretShapeProperty().addListener(new InvalidationListener() { @Override public void invalidated(Observable observable) { + // should this work and caretPosition.addListener(...) be consolidate ? + textNode.impl_caretPositionProperty().set(translateCaretPosition(caretPosition.get())); caretPath.getElements().setAll(textNode.impl_caretShapeProperty().get()); caretWidth = Math.round(caretPath.getLayoutBounds().getWidth()); } Brian, who maintains TextFieldSkin to verify my analysis ? In a way this involves i18n so maybe Leif will be working on this ? Anyway, please advise which temporary fix we should push to the repo in the meantime. Personally I prefer the one-liner in TextFieldSkin. I can push the fix myself if you like.
14-11-2012