I have a JavaFX user interface with several controls; the values should be stored inside fields of a Model class; the UI class has a reference to Model.
Say the Model class is the basic:
public static class Model{String myText; /*javabeans getters and setters provided too*/}
The JavaFX Application is the following.
public class T08 extends Application {
Model model;
@Override
public void start(Stage primaryStage) throws Exception {
model = new Model();
BorderPane bp = new BorderPane();
primaryStage.setScene(new Scene(bp));
//this is the component that should be connected to model.myText
TextField textField = new TextField();
bp.setCenter(textField);
primaryStage.show();
}
One way is to use myTextProperty.bindBidirectional() instead of myTextProperty.bind(), AFAIK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With