HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

JavaFX Tutorial 28.1 Property Bindings.bindBidirectional

1,262 views May 25, 2020 8:26

Watch on YouTube
ChannelCode Amir

Description from the creator

Property bindBidirectional


import java.net.URL;
import java.util.ResourceBundle;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleStringProperty;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TextField;
import javafx.scene.web.HTMLEditor;


/**
*
* @author amir
*/
public class FXMLDocumentController implements Initializable {

@FXML
private TextField txt1;


@FXML
private TextField txt2;


@FXML
private TextField txt3;


@FXML
private HTMLEditor htmleditor;

private SimpleStringProperty s;


@FXML
void click(ActionEvent event) {


txt3.setText(htmleditor.getHtmlText());
}

@Override
public void initialize(URL url, ResourceBundle rb) {
s = new SimpleStringProperty();
s.set("Write Message Here");

Bindings.bindBidirectional(txt1.textProperty(), s);
htmleditor.setHtmlText(s.get());

txt2.textProperty().bind(txt1.textProperty());
}

}

About this tutorial

Code Amir published this 8:26 video tutorial on May 25, 2020. It has been watched 1,262 times on YouTube.

Channel
Code Amir
Category
Education
Duration
8:26
Published
May 25, 2020
Views
1,262
Likes
13

Tags

Share

Further reading

  • Bindings (JavaFX 8) - Oracle docs.oracle.com

    Bindings is a helper class with a lot of utility functions to create simple bindings. Usually there are two possibilities to define the same operation: the Fluent API and the the factory methods in this class. This allo…

  • 28 File Chooser (Release 8) - Oracle docs.oracle.com

    However, this class deserves to be mentioned in the JavaFX UI Controls tutorial, because it supports one of the typical GUI application functions: file system navigation. The FileChooser class is located in the javafx.s…

  • Using JavaFX UI Controls - Oracle docs.oracle.com

    28-1 Configuring a File ... Using the Extra Value Property ... tutorial - Working with JavaFX UI Components. Audience This document is intended for JavaFX developers.

  • java - use of javafx properties and binding in the data model ... stackoverflow.com

    If my data-classes use javafx binding, I would introduce an import javafx.beans.anything; (the best thing would be that bindings were part of java.* or javax.*, so i wouldn't reference a "gui library" into a core-data l…

  • java - Bidirectional bindings of different properties - Stack ... stackoverflow.com

    I just tried to bind a Integer and a String property. After some googling this should be possible with one of the two provided methods: public static void bindBidirectional(Property stringProperty, Property otherPropert…

This tutorial in other languages