changeset 117:1145eb73b1b1

Fixed RT-17968: [TextField] selection is not applied immediately.
author leifs
date Tue, 06 Dec 2011 15:47:29 -0800
parents 4970348dbafd
children be35b718a109
files javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextFieldSkin.java
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextFieldSkin.java	Tue Dec 06 10:01:57 2011 -0500
+++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/skin/TextFieldSkin.java	Tue Dec 06 15:47:29 2011 -0800
@@ -283,9 +283,9 @@
         });
         // updated by listener on caretPosition to ensure order
         textNode.impl_caretPositionProperty().set(textField.getCaretPosition());
-        textField.selectionProperty().addListener(new ChangeListener<IndexRange>() {
-            @Override
-            public void changed(ObservableValue<? extends IndexRange> observable, IndexRange oldValue, IndexRange newValue) {
+        textField.selectionProperty().addListener(new InvalidationListener() {
+            @Override public void invalidated(Observable observable) {
+                IndexRange newValue = getSkinnable().getSelection();
                 if (newValue == null || newValue.getLength() == 0) {
                     textNode.impl_selectionStartProperty().set(-1);
                     textNode.impl_selectionEndProperty().set(-1);