This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.application.Application; | |
import javafx.scene.Scene; | |
import javafx.scene.control.Slider; | |
import javafx.scene.layout.BorderPane; | |
import javafx.scene.web.WebView; | |
import javafx.stage.Stage; | |
public class ScalingDemo extends Application{ | |
public void start(Stage primaryStage) throws Exception { | |
WebView webView = new WebView(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.application.Application; | |
import javafx.beans.property.DoubleProperty; | |
import javafx.beans.property.SimpleDoubleProperty; | |
import javafx.beans.value.ChangeListener; | |
import javafx.beans.value.ObservableValue; | |
import javafx.geometry.Pos; | |
import javafx.scene.Node; | |
import javafx.scene.Scene; | |
import javafx.scene.control.Slider; | |
import javafx.scene.layout.BorderPane; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.beans.property.Property; | |
import javafx.beans.property.SimpleObjectProperty; | |
import javafx.beans.value.ObservableValue; | |
import javafx.beans.value.WeakChangeListener; | |
import java.util.function.Function; | |
/** | |
* A Property which is unidirectionally or bidirectionally bound to a property of a property. What that means: | |
* You have a property A. The object contained in that property A has itself a property B. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Binding with the bind method of a property | |
StringProperty prop1 = new SimpleStringProperty(); | |
StringProperty prop2 = new SimpleStringProperty(); | |
prop1.bind(prop2); | |
prop2.set("Hello World"); | |
Assert.assertEquals(prop1.get(), prop2.get()); | |
//Binding with Bindings.add method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Simple custom IntegerBinding implementation | |
IntegerProperty intVal = new SimpleIntegerProperty(); | |
IntegerBinding modulo2 = new IntegerBinding() { | |
{ bind(intVal);} | |
protected int computeValue() { | |
return intVal.get() % 2; | |
} | |
}; | |
intVal.set(3); | |
Assert.assertEquals(1, modulo2.get()); |