Example usage for javafx.scene.control CheckBox setTooltip

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

Introduction

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

Prototype

public final void setTooltip(Tooltip value) 

Source Link

Usage

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);/*w  w  w  .j av  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.  j  a 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: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 ww  .jav a  2  s .  c om*/
    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);
}

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

private void addCountriesGrid(boolean isEditable, String title, List<CheckBox> checkBoxList,
        List<Country> dataProvider) {
    Label label = addLabel(gridPane, ++gridRow, title, 0);
    label.setWrapText(true);//from  ww  w . jav  a 2 s .  c  om
    label.setMaxWidth(180);
    label.setTextAlignment(TextAlignment.RIGHT);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setValignment(label, VPos.TOP);
    FlowPane flowPane = new FlowPane();
    flowPane.setPadding(new Insets(10, 10, 10, 10));
    flowPane.setVgap(10);
    flowPane.setHgap(10);
    flowPane.setMinHeight(55);

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

    dataProvider.stream().forEach(country -> {
        final String countryCode = country.code;
        CheckBox checkBox = new CheckBox(countryCode);
        checkBox.setUserData(countryCode);
        checkBoxList.add(checkBox);
        checkBox.setMouseTransparent(!isEditable);
        checkBox.setMinWidth(45);
        checkBox.setMaxWidth(45);
        checkBox.setTooltip(new Tooltip(country.name));
        checkBox.setOnAction(event -> {
            if (checkBox.isSelected())
                sepaAccount.addAcceptedCountry(countryCode);
            else
                sepaAccount.removeAcceptedCountry(countryCode);

            updateAllInputsValid();
        });
        flowPane.getChildren().add(checkBox);
    });
    updateCountriesSelection(isEditable, checkBoxList);

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

From source file:dpfmanager.shell.interfaces.gui.fragment.wizard.Wizard1Fragment.java

private void addCheckBox(String id, String name, String path, boolean selected, boolean delete) {
    HBox hbox = new HBox();
    hbox.setAlignment(Pos.CENTER_LEFT);//w ww.  j  a v  a  2  s.  c  o m

    CheckBox chk = new CheckBox(name);
    chk.setId(id);
    chk.getStyleClass().add("checkreport");
    chk.setSelected(selected);
    chk.setEllipsisString(" ... ");
    chk.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
    chk.setTooltip(new Tooltip(path));
    hbox.getChildren().add(chk);

    // EDIT
    Button edit = new Button();
    edit.getStyleClass().addAll("edit-img", "action-img-16");
    edit.setCursor(Cursor.HAND);
    edit.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            String iso = chk.getId();
            String path = null;
            if (iso.startsWith("external")) {
                iso = chk.getText();
                path = iso;
            } else if (chk.getId().startsWith("config")) {
                iso = chk.getId().replace("config", "");
                path = DPFManagerProperties.getIsosDir() + "/" + iso;
            }
            controller.editIso(iso, path);
        }
    });
    hbox.getChildren().add(edit);
    HBox.setMargin(edit, new Insets(0, 0, 0, 10));

    // DELETE
    if (delete) {
        Button icon = new Button();
        icon.getStyleClass().addAll("delete-img", "action-img-16");
        icon.setCursor(Cursor.HAND);
        icon.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                if (chk.getId().startsWith("external")) {
                    // Only from gui
                    vboxRadios.getChildren().remove(hbox);
                } else if (chk.getId().startsWith("config")) {
                    // From system
                    String name = chk.getId().replace("config", "");
                    File file = new File(DPFManagerProperties.getIsosDir() + "/" + name);
                    if (file.exists() && file.isFile() && acceptDelete(file)) {
                        file.delete();
                        vboxRadios.getChildren().remove(hbox);
                    }
                }
            }
        });
        hbox.getChildren().add(icon);
        HBox.setMargin(icon, new Insets(0, 0, 0, 10));
    }

    vboxRadios.getChildren().add(hbox);
}