import java.util.logging.Level; import java.util.logging.Logger; import javafx.scene.Parent; import javafx.scene.control.Button; import javafx.scene.layout.Pane; import javafx.scene.layout.StackPane; public class Test { private Pane view ; public Test(DataModel data) { Logger.getLogger("Test").log(Level.INFO, "Created Test instance"); view = new StackPane(); Button btn = new Button(); btn.textProperty().bind(data.textProperty()); view.getChildren().add(btn); } public Parent getView() { return view ; } }
startStop.textProperty().bind(Bindings .when(service.runningProperty()) .then("Stop")
@Override public void start(Stage primaryStage) { SimpleLocalizedStringProperty prop = new SimpleLocalizedStringProperty("Hello World"); Button btn = new Button(); btn.textProperty().bind(prop); btn.setOnAction((ActionEvent event) -> { prop.set("@@font.dlg.title"); }); StackPane root = new StackPane(); root.getChildren().add(btn); Scene scene = new Scene(root, 500, 300); primaryStage.setScene(scene); primaryStage.show(); }
DoubleProperty fontSize = new SimpleDoubleProperty(12); DoubleProperty rotate = new SimpleDoubleProperty(0); StringProperty text = button.textProperty(); BooleanProperty large = new SimpleBooleanProperty(false);
btn.textProperty().bind(task.messageProperty());
import javafx.application.Application; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class Main extends Application { public void start(Stage stage) { VBox pane = new VBox(); pane.setAlignment(Pos.CENTER); Button button = new Button(); button.textProperty().bind( Bindings.when(button.hoverProperty()) .then("Hovered") .otherwise("Not Hovered")); pane.getChildren().addAll(button); Scene scene = new Scene(pane, 200, 200); stage.setScene(scene); stage.show(); } }
button = new Button("false"); button.setOnAction(e -> setSate()); button.textProperty().bind(state.asString()); BorderPane bp = new BorderPane(comboBox); StackPane stackpane = new StackPane(button);
button.textProperty().bind(task.valueProperty());
button.textProperty().bind(Bindings .when(animation.statusProperty().isEqualTo(Animation.Status.RUNNING)) .then("Stop")
startStop.textProperty().bind(Bindings.when(running).then("Stop").otherwise("Start")); startStop.setOnAction(e -> { if (running.get()) {
expandButton.textProperty().bind( Bindings.when(expanded).then("Hide options").otherwise("Show options"));
newTaskButton.textProperty().bind(Bindings.format("Create task %d", tasksCreated.add(1))); newTaskButton.setOnAction(new EventHandler<ActionEvent>() { @Override
startStop.textProperty().bind( Bindings.when(running) .then("Stop")