Java Reference
In-Depth Information
println(seq);
start = 1;
println(seq);
end = 5;
println(seq);
start = 0;
println(seq);
And here's the output demonstrating how seq changes:
[ 0, 1, 2, 3, 4 ]
[ 5, 6, 7, 8 ]
[ 5, 6, 7, 8, 9 ]
[ 10, 11, 12, 13, 14, 15 ]
Bidirectional Binding
JavaFX binding, by default, is unidirectional in nature—that is, a bound variable
is dependent upon its binding expression—whereas conversely, a bound expres-
sion has no dependency at all on the variable it binds to. Early on in this chapter
we demonstrated that after a variable is bound with the default bind behavior,
any attempt to reassign it will result in an AssignToBoundException . The clas-
sic UI example shown in Listing 4.2 brings this point home.
Listing 4.2
A Simple UI Program Highlighting the Limitations of Unidirectional
Binding
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.ext.swing.SwingTextField;
var str = "Change me";
Stage {
title: "Unidirectional Binding"
scene: Scene {
content: [
SwingTextField {
columns: 25
text: bind str
editable: true
}
]
}
}
 
 
Search WWH ::




Custom Search