Example usage for javafx.scene.control CheckBox selectedProperty

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

Introduction

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

Prototype

public final BooleanProperty selectedProperty() 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);/*from  www  .  ja v a 2 s. c o  m*/
    stage.setHeight(150);
    final CheckBox cb = new CheckBox();
    cb.setText("checkBox");

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

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);//from w w  w  . j a v a2s .co  m
    stage.setHeight(150);
    final CheckBox cb = new CheckBox();
    cb.setText("checkBox");
    cb.setSelected(true);

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

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Checkbox Sample");
    stage.setWidth(230);/*from ww w. j a v a 2 s. c o  m*/
    stage.setHeight(120);

    for (int i = 0; i < names.length; i++) {
        final CheckBox cb = cbs[i] = new CheckBox(names[i]);
        cb.selectedProperty().addListener(new ChangeListener<Boolean>() {
            public void changed(ObservableValue ov, Boolean old_val, Boolean new_val) {
                System.out.println(new_val);
            }
        });
    }

    VBox vbox = new VBox();
    vbox.getChildren().addAll(cbs);
    vbox.setSpacing(5);

    HBox hbox = new HBox();
    hbox.setPadding(new Insets(0, 0, 0, 5));

    StackPane stack = new StackPane();
    stack.getChildren().add(hbox);

    HBox root = new HBox();
    root.getChildren().add(vbox);
    root.getChildren().add(stack);
    root.setSpacing(40);
    root.setPadding(new Insets(20, 10, 10, 20));

    ((Group) scene.getRoot()).getChildren().add(root);

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

From source file:Main.java

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

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

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

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 v  a 2  s . c  o  m
    stage.setHeight(150);
    final CheckBox cb = new CheckBox();
    cb.setText("checkBox");
    cb.setAllowIndeterminate(true);

    cb.selectedProperty().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();
}

From source file:Main.java

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

    cb.selectedProperty().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.isAllowIndeterminate());
        }
    });
    ((Group) scene.getRoot()).getChildren().add(cb);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Tooltip Sample");
    stage.setWidth(300);//from w  ww. ja v  a2  s .co m
    stage.setHeight(150);
    final CheckBox cb = new CheckBox("checkBox");
    final Tooltip tooltip = new Tooltip("$ tooltip");
    tooltip.setFont(new Font("Arial", 16));
    cb.setTooltip(tooltip);
    cb.selectedProperty().addListener(new ChangeListener<Boolean>() {
        public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) {
            System.out.println(cb.isSelected());
        }
    });

    ((Group) scene.getRoot()).getChildren().add(cb);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);// w w  w. ja  va 2 s.  c  o  m
    stage.setHeight(150);
    final CheckBox cb = new CheckBox();
    cb.setText("checkBox");
    final Tooltip tooltip = new Tooltip("$ tooltip");
    tooltip.setFont(new Font("Arial", 16));
    cb.setTooltip(tooltip);
    cb.selectedProperty().addListener(new ChangeListener<Boolean>() {
        public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) {
            System.out.println(cb.isSelected());
        }
    });

    ((Group) scene.getRoot()).getChildren().add(cb);

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

From source file:de.rkl.tools.tzconv.view.ZoneIdSelectionDialog.java

private Node createZoneIdSelectionBox() {
    final HBox mainListBox = new HBox(5);
    partition(newArrayList(ApplicationModel.ZONE_OFFSETS_2_ZONE_IDS.values()), 40).forEach(zoneIds -> {
        final VBox columnBox = new VBox(5);
        zoneIds.forEach(zoneId -> {/*  w  w  w .jav  a2 s . c o m*/
            final CheckBox zoneIdCheckbox = new CheckBox(zoneId.toString());
            zoneIdCheckbox.setSelected(applicationModel.selectedZoneIds.contains(zoneId));
            zoneIdCheckbox.selectedProperty().addListener((observable, oldValue, newValue) -> {
                if (newValue) {
                    pendingSelectedZoneIds.add(zoneId);
                } else {
                    pendingSelectedZoneIds.remove(zoneId);
                }
            });
            columnBox.getChildren().add(zoneIdCheckbox);
            zoneIdCheckboxes.add(zoneIdCheckbox);
        });
        mainListBox.getChildren().add(columnBox);
    });
    return mainListBox;
}

From source file:Main.java

@Override
public void start(final Stage stage) {
    final Node loginPanel = makeDraggable(createLoginPanel());
    final Node confirmationPanel = makeDraggable(createConfirmationPanel());
    final Node progressPanel = makeDraggable(createProgressPanel());

    loginPanel.relocate(0, 0);/*from w  ww  .  j av  a2s.c  o m*/
    confirmationPanel.relocate(0, 67);
    progressPanel.relocate(0, 106);

    final Pane panelsPane = new Pane();
    panelsPane.getChildren().addAll(loginPanel, confirmationPanel, progressPanel);

    final BorderPane sceneRoot = new BorderPane();

    BorderPane.setAlignment(panelsPane, Pos.TOP_LEFT);
    sceneRoot.setCenter(panelsPane);

    final CheckBox dragModeCheckbox = new CheckBox("Drag mode");
    BorderPane.setMargin(dragModeCheckbox, new Insets(6));
    sceneRoot.setBottom(dragModeCheckbox);

    dragModeActiveProperty.bind(dragModeCheckbox.selectedProperty());

    final Scene scene = new Scene(sceneRoot, 400, 300);
    stage.setScene(scene);
    stage.setTitle("Draggable Panels Example");
    stage.show();
}