Please see the attached test case. Press the left key to toggle the content and column size of Textbox. IT doesn't work . Now uncomment the lines 52 , 53 and repeat the same and it works. Why should we refresh the layout to see the change to take effect? Also on closing the application window we see the following Exception.
java.lang.RuntimeException: A bound value cannot be set.
at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:102)
at javafx.scene.control.TextInputControl.setText(TextInputControl.java:135)
at javafx.scene.control.TextInputControl.commit(TextInputControl.java:911)
at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.focusChanged(TextInputControlBehavior.java:586)
at com.sun.javafx.scene.control.behavior.TextInputControlBehavior$1.invalidated(TextInputControlBehavior.java:231)
at javafx.beans.value.ObservableValueBase.fireValueChangedEvent(ObservableValueBase.java:107)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:58)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:108)
at javafx.scene.Node.setFocused(Node.java:4663)
at javafx.scene.Scene$KeyHandler.setWindowFocused(Scene.java:2288)
at javafx.scene.Scene$KeyHandler$1.invalidated(Scene.java:2307)
at javafx.beans.value.ObservableValueBase.fireValueChangedEvent(ObservableValueBase.java:107)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:58)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:108)
at javafx.stage.Window.setFocused(Window.java:224)
at com.sun.javafx.stage.WindowPeerListener.changedFocused(WindowPeerListener.java:47)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.handleWindowEvent(GlassWindowEventHandler.java:47)
at com.sun.glass.ui.Window.handleWindowEvent(Window.java:874)
at com.sun.glass.ui.Window.notifyFocus(Window.java:857)
at com.sun.glass.ui.win.WinWindow._setVisible(Native Method)
at com.sun.glass.ui.Window.setVisible(Window.java:354)
at com.sun.javafx.tk.quantum.WindowStage.setVisible(WindowStage.java:343)
at javafx.stage.Window$12.invalidated(Window.java:490)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:57)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:108)
at javafx.stage.Window.setVisible(Window.java:515)
at javafx.stage.Stage.setVisible(Stage.java:105)
at javafx.stage.Window.hide(Window.java:526)
at com.sun.javafx.stage.WindowPeerListener.closing(WindowPeerListener.java:64)
at com.sun.javafx.tk.quantum.GlassStage.close(GlassStage.java:97)
at com.sun.javafx.tk.quantum.WindowStage.close(WindowStage.java:416)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.handleWindowEvent(GlassWindowEventHandler.java:30)
at com.sun.glass.ui.Window.handleWindowEvent(Window.java:874)
at com.sun.glass.ui.Window.notifyClose(Window.java:791)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$1$1.run(WinApplication.java:49)
at java.lang.Thread.run(Thread.java:662)
java.lang.RuntimeException: A bound value cannot be set.
at javafx.beans.property.StringPropertyBase.set(StringPropertyBase.java:102)
at javafx.scene.control.TextInputControl.setText(TextInputControl.java:135)
at javafx.scene.control.TextInputControl.commit(TextInputControl.java:911)
at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.focusChanged(TextInputControlBehavior.java:586)
at com.sun.javafx.scene.control.behavior.TextInputControlBehavior$1.invalidated(TextInputControlBehavior.java:231)
at javafx.beans.value.ObservableValueBase.fireValueChangedEvent(ObservableValueBase.java:107)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:58)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:108)
at javafx.scene.Node.setFocused(Node.java:4663)
at javafx.scene.Scene$KeyHandler.setWindowFocused(Scene.java:2288)
at javafx.scene.Scene$KeyHandler$1.invalidated(Scene.java:2307)
at javafx.beans.value.ObservableValueBase.fireValueChangedEvent(ObservableValueBase.java:107)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:58)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:108)
at javafx.stage.Window.setFocused(Window.java:224)
at com.sun.javafx.stage.WindowPeerListener.changedFocused(WindowPeerListener.java:47)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.handleWindowEvent(GlassWindowEventHandler.java:47)
at com.sun.glass.ui.Window.handleWindowEvent(Window.java:874)
at com.sun.glass.ui.Window.notifyFocus(Window.java:857)
at com.sun.glass.ui.win.WinWindow._setVisible(Native Method)
at com.sun.glass.ui.Window.setVisible(Window.java:354)
at com.sun.javafx.tk.quantum.WindowStage.setVisible(WindowStage.java:343)
at javafx.stage.Window$12.invalidated(Window.java:490)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:57)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:108)
at javafx.stage.Window.setVisible(Window.java:515)
at javafx.stage.Stage.setVisible(Stage.java:105)
at javafx.stage.Window.hide(Window.java:526)
at com.sun.javafx.stage.WindowPeerListener.closing(WindowPeerListener.java:64)
at com.sun.javafx.tk.quantum.GlassStage.close(GlassStage.java:97)
at com.sun.javafx.tk.quantum.WindowStage.close(WindowStage.java:416)
at com.sun.javafx.tk.quantum.GlassWindowEventHandler.handleWindowEvent(GlassWindowEventHandler.java:30)
at com.sun.glass.ui.Window.handleWindowEvent(Window.java:874)
at com.sun.glass.ui.Window.notifyClose(Window.java:791)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$1$1.run(WinApplication.java:49)
at java.lang.Thread.run(Thread.java:662)