Java Reference
In-Depth Information
Listing 4.3
A Simple UI Program Demonstrating Bind with Inverse
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.ext.swing.SwingTextField;
var str = "Change me";
Stage {
title: "Bind with inverse"
scene: Scene {
content: [
SwingTextField {
columns: 25
text: bind str with inverse
editable: true
}
]
}
}
Not all too different from the first, Figure 4.4 shows what the new program looks
like at startup.
Figure 4.4
Initial Appearance of UI Using Bind with Inverse
This time, the TextField can be modified with no ill effects, as demonstrated by
Figure 4.5.
Figure 4.5
Using Bind with Inverse Allows the TextField to Be Modified
One final point worth mentioning about the bind with inverse construct is that it
is limited to variable declarations. Attempting to use any other type of expres-
sion in this context will result in a compile time error.
 
Search WWH ::




Custom Search