Example usage for javafx.scene.control Button managedProperty

List of usage examples for javafx.scene.control Button managedProperty

Introduction

In this page you can find the example usage for javafx.scene.control Button managedProperty.

Prototype

public final BooleanProperty managedProperty() 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Button b1 = new Button("B1");
    Button b2 = new Button("B2");
    Button b3 = new Button("B3");
    Button visibleBtn = new Button("Make Invisible");

    visibleBtn.setOnAction(e -> b2.setVisible(!b2.isVisible()));

    visibleBtn.textProperty().bind(new When(b2.visibleProperty()).then("Invisible").otherwise("Visible"));

    b2.managedProperty().bind(b2.visibleProperty());

    HBox root = new HBox();
    root.getChildren().addAll(visibleBtn, b1, b2, b3);

    Scene scene = new Scene(root);
    stage.setScene(scene);// w w w .  j  a  v a2s  . c o  m
    stage.setTitle("");
    stage.show();
}