Example usage for javafx.scene.control Tooltip Tooltip

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

Introduction

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

Prototype

public Tooltip(String text) 

Source Link

Document

Creates a tooltip with the specified text.

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);/*from  w w w.j a  va  2s .  com*/
    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) {
    VBox vbox = new VBox(20);
    Scene scene = new Scene(vbox, 400, 400);
    stage.setScene(scene);//w  w  w. j  a  v  a2 s .c  o m
    final DatePicker startDatePicker = new DatePicker();
    DatePicker endDatePicker = new DatePicker();
    startDatePicker.setValue(LocalDate.now());
    final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() {
        @Override
        public DateCell call(final DatePicker datePicker) {
            return new DateCell() {
                @Override
                public void updateItem(LocalDate item, boolean empty) {
                    super.updateItem(item, empty);

                    long p = ChronoUnit.DAYS.between(startDatePicker.getValue(), item);
                    setTooltip(new Tooltip("You're about to stay for " + p + " days"));
                }
            };
        }
    };
    endDatePicker.setDayCellFactory(dayCellFactory);
    endDatePicker.setValue(startDatePicker.getValue().plusDays(1));
    vbox.getChildren().add(new Label("Start Date:"));
    vbox.getChildren().add(startDatePicker);
    vbox.getChildren().add(new Label("End Date:"));
    vbox.getChildren().add(endDatePicker);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    scene.setFill(Color.ALICEBLUE);
    stage.setScene(scene);//  w w  w  .  j  ava2 s. c  om
    stage.show();

    stage.setWidth(300);
    stage.setHeight(200);

    label.setStyle("-fx-font: 25 arial;");
    label.setLayoutX(40);

    rect.setStroke(Color.BLUE);
    rect.setStrokeWidth(3);
    rect.setFill(Color.WHITE);

    final String[] greetings = new String[] { "A", "B", "C", "D", "E" };
    final ChoiceBox<String> cb = new ChoiceBox<String>(
            FXCollections.observableArrayList("a", "b", "c", "d", "e"));

    cb.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
        public void changed(ObservableValue ov, Number value, Number new_value) {
            label.setText(greetings[new_value.intValue()]);
        }
    });

    cb.setTooltip(new Tooltip("Select the language"));
    cb.setValue("English");
    HBox hb = new HBox();
    hb.getChildren().addAll(cb, label);
    hb.setSpacing(30);
    hb.setAlignment(Pos.CENTER);
    hb.setPadding(new Insets(10, 0, 0, 10));

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

}

From source file:cz.lbenda.gui.tableView.FilterableTableColumn.java

@SuppressWarnings("unused")
public FilterableTableColumn(String label, String tooltip) {
    this();// w  w  w  .j  av a2 s.c o m
    setTitle(label);
    if (!StringUtils.isEmpty(tooltip)) {
        title.setTooltip(new Tooltip(tooltip));
    }
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    scene.setFill(Color.ALICEBLUE);
    stage.setScene(scene);/*from   ww  w. j  a va 2s.c  o m*/
    stage.show();

    stage.setTitle("ChoiceBox Sample");
    stage.setWidth(300);
    stage.setHeight(200);

    label.setStyle("-fx-font: 25 arial;");
    label.setLayoutX(40);

    rect.setArcHeight(8);
    rect.setArcWidth(8);
    rect.setStroke(Color.BLUE);
    rect.setStrokeWidth(3);
    rect.setFill(Color.WHITE);

    final String[] greetings = new String[] { "Hello", "Hola", "??????", "?", "?????" };
    final ChoiceBox cb = new ChoiceBox(
            FXCollections.observableArrayList("English", "Espaol", "???????", "????", "???"));

    cb.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
        public void changed(ObservableValue ov, Number value, Number new_value) {
            label.setText(greetings[new_value.intValue()]);
        }
    });

    cb.setTooltip(new Tooltip("Select the language"));
    cb.setValue("English");
    HBox hb = new HBox();
    hb.getChildren().addAll(cb, label);
    hb.setSpacing(30);
    hb.setAlignment(Pos.CENTER);
    hb.setPadding(new Insets(10, 0, 0, 10));

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

}

From source file:com.esri.geoevent.test.performance.ui.ReportOptionsController.java

@Override
public void initialize(URL location, ResourceBundle resources) {
    reportTypeLabel.setText(UIMessages.getMessage("UI_REPORT_TYPE_LABEL"));
    reportType.setItems(getReportTypes());
    reportType.setValue(report.getType());
    reportFileLocationLabel.setText(UIMessages.getMessage("UI_REPORT_FILE_LOCATION_LABEL"));
    reportFileLocationBtn.setText(UIMessages.getMessage("UI_REPORT_FILE_BROWSE_LABEL"));
    reportFileLocationBtn.setTooltip(new Tooltip(UIMessages.getMessage("UI_REPORT_FILE_BROWSE_DESC")));
    allCoumnsLabel.setText(UIMessages.getMessage("UI_ALL_COLUMNS_LABEL"));
    selectedCoumnsLabel.setText(UIMessages.getMessage("UI_SELECTED_COLUMNS_LABEL"));
    allColumns.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    selectedColumns.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    okBtn.setText(UIMessages.getMessage("UI_OK_BTN_LABEL"));
    cancelBtn.setText(UIMessages.getMessage("UI_CANCEL_BTN_LABEL"));

    // lookup current directory and add "/report" to it
    updateSelectedReportFile(report.getReportFile());
    updateSelectedReportColumns(report.getReportColumns());
}

From source file:com.advos.notehub.client.util.sandsoft.CustomHTMLEditor.java

/**
 * Creates Custom ToolBar buttons and other controls
 *///  w w w  .  j  ava2  s . c  om
private void createCustomButtons() {
    //add embed file button  
    ImageView graphic = new ImageView(new Image(getClass().getResourceAsStream(IMPORT_BUTTON_GENERAL)));
    mImportFileButton = new Button("Import File", graphic);
    mImportFileButton.setTooltip(new Tooltip("Import File"));
    mImportFileButton.setOnAction((event) -> onImportFileButtonAction());

    //add to top toolbar         
    mTopToolBar.getItems().add(mImportFileButton);
    mTopToolBar.getItems().add(new Separator(Orientation.VERTICAL));
}

From source file:dsfixgui.view.DSFUnsafeSettingsPane.java

private void initialize() {

    //Basic layout
    this.setFitToWidth(true);

    spacerColumn = new ColumnConstraints();
    spacerColumn.setFillWidth(true);/*ww w.  j ava  2 s. c  om*/
    spacerColumn.setPercentWidth(3.0);
    primaryColumn = new ColumnConstraints();
    primaryColumn.setFillWidth(true);
    primaryColumn.setPercentWidth(95.0);
    primaryPane = new GridPane();
    primaryPane.getColumnConstraints().addAll(spacerColumn, primaryColumn);
    primaryVBox = new VBox();
    primaryVBox.getStyleClass().add("spacing_15");
    primaryPane.add(primaryVBox, 1, 0);
    titleLabel = new Label(UNSAFE_OPS.toUpperCase() + " " + SETTINGS.toUpperCase());
    titleLabel.getStyleClass().addAll("settings_title", "red_text");
    titleLabel.setTooltip(new Tooltip(UNSAFE_TT));
    titleBar = new HBox();
    titleBar.setAlignment(Pos.CENTER);
    titleBar.getChildren().add(titleLabel);
    restoreDefaultsBar = new HBox();
    restoreDefaultsBar.setAlignment(Pos.CENTER);
    restoreDefaultsBar.setSpacing(5.0);
    applySettingsButton = new Button(APPLY_SETTINGS);
    restoreDefaultsButton = new Button(RESTORE_DEFAULTS);
    applySettingsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsButton.getStyleClass().add("translate_y_4");
    restoreDefaultsBar.getChildren().addAll(applySettingsButton, restoreDefaultsButton);
    spacerHBox = new HBox();
    spacerHBox.setMinHeight(10.0);
    bottomSpacerHBox = new HBox();
    bottomSpacerHBox.setMinHeight(10.0);

    /////////////////////SETTINGS PANES/////////////////////
    //
    //
    //Force Window Modes
    windowModePane = new FlowPane();
    windowModePane.getStyleClass().add("settings_pane");
    windowModeLabel = new Label(FORCE_WINDOW_MODE_LABEL + "  ");
    windowModeLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    windowModeChoice = new ToggleGroup();
    neitherWindowMode = new RadioButton(WINDOW_MODES[0] + "   ");
    neitherWindowMode.setToggleGroup(windowModeChoice);
    forceWindowed = new RadioButton(WINDOW_MODES[1]);
    forceWindowed.setToggleGroup(windowModeChoice);
    forceFullscreen = new RadioButton(WINDOW_MODES[2]);
    forceFullscreen.setToggleGroup(windowModeChoice);
    if (config.forceWindowed.get() == 0 && config.forceFullscreen.get() == 0) {
        neitherWindowMode.setSelected(true);
    } else if (config.forceWindowed.get() == 1) {
        forceWindowed.setSelected(true);
        config.forceFullscreen.set(0);
    } else {
        forceFullscreen.setSelected(true);
    }
    windowModePane.getChildren().addAll(windowModeLabel, neitherWindowMode, forceWindowed, forceFullscreen);
    //
    //Toggle Vsync
    vsyncPane = new FlowPane();
    vsyncPane.getStyleClass().add("settings_pane");
    vsyncLabel = new Label(VSYNC_LABEL + "  ");
    vsyncLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    vsyncLabel.setTooltip(new Tooltip(VSYNC_TT));
    vsyncPicker = new ComboBox(FXCollections.observableArrayList(DISABLE_ENABLE));
    if (config.enableVsync.get() == 0) {
        vsyncPicker.setValue(vsyncPicker.getItems().get(0));
    } else {
        vsyncPicker.setValue(vsyncPicker.getItems().get(1));
    }
    vsyncPane.getChildren().addAll(vsyncLabel, vsyncPicker);
    //
    //Fullscreen Refresh Rate
    refreshRatePane = new FlowPane();
    refreshRatePane.getStyleClass().add("settings_pane");
    refreshRateLabel = new Label(REFRESH_RATE_LABEL + " ");
    refreshRateLabel.getStyleClass().addAll("bold_text", "font_12_pt");
    refreshRateLabel.setTooltip(new Tooltip(FULLSCREEN_HZ_TT));
    refreshRateField = new TextField("" + config.fullscreenHz.get());
    refreshRateField.getStyleClass().add("settings_text_field");
    refreshRatePane.getChildren().addAll(refreshRateLabel, refreshRateField);
    //

    primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, windowModePane, vsyncPane,
            refreshRatePane, bottomSpacerHBox);
    initializeEventHandlers();

    this.setContent(primaryPane);
}

From source file:de.micromata.mgc.javafx.launcher.gui.AbstractConfigTabController.java

protected void addTooltip(Control node, String field) {
    String cmd = getModel().findCommentForProperty(field);
    if (StringUtils.isBlank(cmd) == true) {
        return;/*w ww  .  ja v  a2  s.c o m*/
    }
    node.setTooltip(new Tooltip(cmd));
}

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);/*www. ja v a2  s.  c  o 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);
}