Fixed RT-20845: TextField with bidirectional binding is not editable in applet but editable in standalone execution mode diff -r 2e6dd4d24206 -r c398a47a8ec5 javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextInputControlBehavior.java --- a/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextInputControlBehavior.java Thu Jul 12 00:28:13 2012 -0400 +++ b/javafx-ui-controls/src/com/sun/javafx/scene/control/behavior/TextInputControlBehavior.java Thu Jul 12 17:52:36 2012 +0200 @@ -216,7 +216,7 @@ // + character.length() > textInput.getMaximumLength()) { // // TODO Beep? // } else { - undoManager.addChange(start, textInput.getText().substring(start, end), character, true); + undoManager.addChange(start, textInput.textProperty().getValueSafe().substring(start, end), character, true); replaceText(start, end, character); // } @@ -294,10 +294,12 @@ private void cut() { TextInputControl textInputControl = getControl(); IndexRange selection = textInputControl.getSelection(); - int start = selection.getStart(); - int end = selection.getEnd(); - undoManager.addChange(start, textInputControl.getText().substring(start, end), null); + if (selection.getLength() > 0) { + int start = selection.getStart(); + int end = selection.getEnd(); + undoManager.addChange(start, textInputControl.getText().substring(start, end), null); + } textInputControl.cut(); } @@ -306,13 +308,13 @@ IndexRange selection = textInputControl.getSelection(); int start = selection.getStart(); int end = selection.getEnd(); - String text = textInputControl.getText(); + String text = textInputControl.textProperty().getValueSafe(); String deleted = text.substring(start, end); int tail = text.length() - end; textInputControl.paste(); - text = textInputControl.getText(); + text = textInputControl.textProperty().getValueSafe(); undoManager.addChange(start, deleted, text.substring(start, text.length() - tail)); }