Example usage for javafx.scene.control CheckBox CheckBox

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

Introduction

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

Prototype

public CheckBox(String text) 

Source Link

Document

Creates a check box with the specified text as its label.

Usage

From source file:Main.java

License:asdf

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group(), 450, 250);

    TilePane tile = new TilePane(Orientation.VERTICAL, 0.5, 0.5);
    tile.setHgap(8);//  ww  w.j  ava 2s. c  o  m
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new CheckBox("asdf"));
    }

    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(tile);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

License:asdf

@Override
public void start(Stage stage) {
    stage.setTitle("TitledPane");
    Scene scene = new Scene(new Group(), 450, 250);
    scene.setFill(Color.GHOSTWHITE);

    TilePane tile = new TilePane();
    tile.setHgap(8);/*from w w w.  ja va  2 s  . co  m*/
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new CheckBox("asdf"));
    }

    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(tile);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(hbox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

License:asdf

@Override
public void start(Stage stage) {
    stage.setTitle("TitledPane");
    Scene scene = new Scene(new Group(), 450, 250);
    scene.setFill(Color.GHOSTWHITE);

    TilePane tile = new TilePane(0.3, 0.5);
    tile.setHgap(8);/*  w w  w  .j av a 2s  .  c o  m*/
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new CheckBox("asdf"));
    }

    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(tile);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(hbox);
    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);// w  ww.  j  a va  2 s  .  c  o  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);

    ((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 w  w . j  a v a2 s.c  o  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

License:asdf

@Override
public void start(Stage stage) {
    stage.setTitle("TitledPane");
    Scene scene = new Scene(new Group(), 450, 250);
    scene.setFill(Color.GHOSTWHITE);

    TilePane tile = new TilePane(Orientation.VERTICAL);
    tile.setHgap(8);/*from  ww  w.j  av a 2 s  .  c om*/
    tile.setPrefColumns(4);
    for (int i = 0; i < 20; i++) {
        tile.getChildren().add(new CheckBox("asdf"));
    }

    HBox hbox = new HBox(10);
    hbox.setPadding(new Insets(20, 0, 0, 20));
    hbox.getChildren().setAll(tile);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(hbox);
    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   www  . 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: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  .j  av  a2  s.  co  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);/*www .j  a  va  2  s . c  om*/
    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();
}

From source file:io.bitsquare.gui.components.paymentmethods.OKPayForm.java

private void addCurrenciesGrid(boolean isEditable) {
    Label label = addLabel(gridPane, ++gridRow, "Supported currencies:", 0);
    GridPane.setValignment(label, VPos.TOP);
    FlowPane flowPane = new FlowPane();
    flowPane.setPadding(new Insets(10, 10, 10, 10));
    flowPane.setVgap(10);//from   w w w . j a v  a2  s .  co  m
    flowPane.setHgap(10);

    if (isEditable)
        flowPane.setId("flow-pane-checkboxes-bg");
    else
        flowPane.setId("flow-pane-checkboxes-non-editable-bg");

    CurrencyUtil.getAllOKPayCurrencies().stream().forEach(e -> {
        CheckBox checkBox = new CheckBox(e.getCode());
        checkBox.setMouseTransparent(!isEditable);
        checkBox.setSelected(okPayAccount.getTradeCurrencies().contains(e));
        checkBox.setMinWidth(60);
        checkBox.setMaxWidth(checkBox.getMinWidth());
        checkBox.setTooltip(new Tooltip(e.getName()));
        checkBox.setOnAction(event -> {
            if (checkBox.isSelected())
                okPayAccount.addCurrency(e);
            else
                okPayAccount.removeCurrency(e);

            updateAllInputsValid();
        });
        flowPane.getChildren().add(checkBox);
    });

    GridPane.setRowIndex(flowPane, gridRow);
    GridPane.setColumnIndex(flowPane, 1);
    gridPane.getChildren().add(flowPane);
}