Example usage for javafx.scene.control Button visibleProperty

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

Introduction

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

Prototype

public final BooleanProperty visibleProperty() 

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);/*from ww  w .ja va 2  s .com*/
    stage.setTitle("");
    stage.show();
}