Example usage for javafx.scene.control CheckBox allowIndeterminateProperty

List of usage examples for javafx.scene.control CheckBox allowIndeterminateProperty

Introduction

In this page you can find the example usage for javafx.scene.control CheckBox allowIndeterminateProperty.

Prototype

public final BooleanProperty allowIndeterminateProperty() 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);//from   w  ww. j  a  va  2s  .c om
    stage.setHeight(150);
    final CheckBox cb = new CheckBox();
    cb.setText("checkBox");
    cb.setAllowIndeterminate(true);

    cb.allowIndeterminateProperty().addListener(new ChangeListener<Boolean>() {
        public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) {
            System.out.println(cb.isSelected());
            System.out.println(cb.isIndeterminate());
        }
    });
    ((Group) scene.getRoot()).getChildren().add(cb);

    stage.setScene(scene);
    stage.show();
}