Java Code Examples for javafx.scene.control.CheckBox#setTooltip()

The following examples show how to use javafx.scene.control.CheckBox#setTooltip() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HighlightOptions.java    From LogFX with GNU General Public License v3.0 6 votes vote down vote up
Row( String pattern, Paint backgroundColor, Paint fillColor, boolean isFiltered ) {
    setSpacing( 5 );

    expressionField = new TextField( pattern );
    expressionField.setMinWidth( 300 );
    expressionField.setTooltip( new Tooltip( "Enter a regular expression." ) );

    bkgColorPicker = new ColorChooser( backgroundColor.toString(), "Enter the background color." );
    fillColorPicker = new ColorChooser( fillColor.toString(), "Enter the text color." );

    isFilteredBox = new CheckBox();
    isFilteredBox.setSelected( isFiltered );
    isFilteredBox.setTooltip( new Tooltip( "Include in filter" ) );

    InvalidationListener updater = ( ignore ) ->
            update( bkgColorPicker.getColor(), fillColorPicker.getColor(), isFilteredBox.selectedProperty().get() );

    bkgColorPicker.addListener( updater );
    fillColorPicker.addListener( updater );
    isFilteredBox.selectedProperty().addListener( updater );
    expressionField.textProperty().addListener( updater );

    setMinWidth( 500 );
}
 
Example 2
Source File: PaymentMethodForm.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
void fillUpFlowPaneWithCurrencies(boolean isEditable, FlowPane flowPane,
                                  TradeCurrency e, PaymentAccount paymentAccount) {
    CheckBox checkBox = new AutoTooltipCheckBox(e.getCode());
    checkBox.setMouseTransparent(!isEditable);
    checkBox.setSelected(paymentAccount.getTradeCurrencies().contains(e));
    checkBox.setMinWidth(60);
    checkBox.setMaxWidth(checkBox.getMinWidth());
    checkBox.setTooltip(new Tooltip(e.getName()));
    checkBox.setOnAction(event -> {
        if (checkBox.isSelected())
            paymentAccount.addCurrency(e);
        else
            paymentAccount.removeCurrency(e);

        updateAllInputsValid();
    });
    flowPane.getChildren().add(checkBox);
}
 
Example 3
Source File: PaymentMethodForm.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
void fillUpFlowPaneWithCountries(List<CheckBox> checkBoxList, FlowPane flowPane, Country country) {
    final String countryCode = country.code;
    CheckBox checkBox = new AutoTooltipCheckBox(countryCode);
    checkBox.setUserData(countryCode);
    checkBoxList.add(checkBox);
    checkBox.setMouseTransparent(false);
    checkBox.setMinWidth(45);
    checkBox.setMaxWidth(45);
    checkBox.setTooltip(new Tooltip(country.name));
    checkBox.setOnAction(event -> {
        if (checkBox.isSelected()) {
            addAcceptedCountry(countryCode);
        } else {
            removeAcceptedCountry(countryCode);
        }

        updateAllInputsValid();
    });
    flowPane.getChildren().add(checkBox);
}
 
Example 4
Source File: TooltipSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Tooltip Sample");
    stage.setWidth(330);
    stage.setHeight(150);

    total.setFont(new Font("Arial", 20));

    for (int i = 0; i < rooms.length; i++) {
        final CheckBox cb = cbs[i] = new CheckBox(rooms[i]);
        final Integer rate = rates[i];
        final Tooltip tooltip = new Tooltip("$" + rates[i].toString());
        tooltip.setFont(new Font("Arial", 16));
        cb.setTooltip(tooltip);
        cb.selectedProperty().addListener((ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) -> {
            if (cb.isSelected()) {
                sum = sum + rate;
            } else {
                sum = sum - rate;
            }
            total.setText("Total: $" + sum.toString());
        });
    }

    VBox vbox = new VBox();
    vbox.getChildren().addAll(cbs);
    vbox.setSpacing(5);
    HBox root = new HBox();
    root.getChildren().add(vbox);
    root.getChildren().add(total);
    root.setSpacing(40);
    root.setPadding(new Insets(20, 10, 10, 20));

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

    stage.setScene(scene);
    stage.show();
}
 
Example 5
Source File: SpectraBottomPanel.java    From mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
SpectraBottomPanel(SpectraVisualizerWindow masterFrame, RawDataFile dataFile) {

    // super(new BorderLayout());
    this.dataFile = dataFile;
    this.masterFrame = masterFrame;

    // setBackground(Color.white);

    topPanel = new FlowPane();
    // topPanel.setBackground(Color.white);
    // topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
    setCenter(topPanel);

    // topPanel.add(Box.createHorizontalStrut(10));

    Button prevScanBtn = new Button(leftArrow);
    // prevScanBtn.setBackground(Color.white);
    // prevScanBtn.setFont(smallFont);

    // topPanel.add(Box.createHorizontalGlue());

    Label featureListLabel = new Label("Feature list: ");

    peakListSelector = new ComboBox<PeakList>(
        MZmineCore.getProjectManager().getCurrentProject().getFeatureLists());
    // peakListSelector.setBackground(Color.white);
    // peakListSelector.setFont(smallFont);
    peakListSelector.setOnAction(
        e -> masterFrame.loadPeaks(peakListSelector.getSelectionModel().getSelectedItem()));

    processingCbx = new CheckBox("Enable Processing");
    processingCbx.setTooltip(new Tooltip("Enables quick scan processing."));
    processingCbx.setOnAction(e -> masterFrame.enableProcessing());
    updateProcessingCheckbox();

    processingParametersBtn = new Button("Spectra processing");
    processingParametersBtn
        .setTooltip(new Tooltip("Set the parameters for quick spectra processing."));
    processingParametersBtn.setOnAction(e -> masterFrame.setProcessingParams());
    updateProcessingButton();

    // topPanel.add(Box.createHorizontalGlue());

    Button nextScanBtn = new Button(rightArrow);
    nextScanBtn.setOnAction(e -> masterFrame.loadNextScan());

    topPanel.getChildren().addAll(prevScanBtn, featureListLabel, peakListSelector, processingCbx,
        processingParametersBtn, nextScanBtn);

    // nextScanBtn.setBackground(Color.white);
    // nextScanBtn.setFont(smallFont);

    // topPanel.add(Box.createHorizontalStrut(10));

    bottomPanel = new FlowPane();
    // bottomPanel.setBackground(Color.white);
    // bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
    setBottom(bottomPanel);

    // bottomPanel.add(Box.createHorizontalGlue());

    Label msmsLabel = new Label("MS/MS: ");

    msmsSelector = new ComboBox<String>();
    // msmsSelector.setBackground(Color.white);
    // msmsSelector.setFont(smallFont);

    Button showButton = new Button("Show");
    bottomPanel.getChildren().addAll(msmsLabel, msmsSelector, showButton);

    // showButton.setBackground(Color.white);
    showButton.setOnAction(e -> {
      String selectedScanString = msmsSelector.getSelectionModel().getSelectedItem();
      if (selectedScanString == null)
        return;

      int sharpIndex = selectedScanString.indexOf('#');
      int commaIndex = selectedScanString.indexOf(',');
      selectedScanString = selectedScanString.substring(sharpIndex + 1, commaIndex);
      int selectedScan = Integer.valueOf(selectedScanString);

      SpectraVisualizerModule.showNewSpectrumWindow(dataFile, selectedScan);
    });
    // showButton.setFont(smallFont);

    // bottomPanel.add(Box.createHorizontalGlue());

  }
 
Example 6
Source File: TransposedDataSetSample.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
@Override
public void start(final Stage primaryStage) {
    // init default 2D Chart
    final XYChart chart1 = getDefaultChart();
    final ErrorDataSetRenderer renderer = (ErrorDataSetRenderer) chart1.getRenderers().get(0);
    renderer.setAssumeSortedData(false); // necessary to suppress sorted-DataSet-only optimisations

    // alternate DataSet:
    // final CosineFunction dataSet1 = new CosineFunction("test cosine", N_SAMPLES);
    final DataSet dataSet1 = test8Function(0, 4, -1, 3, (Math.PI / N_SAMPLES) * 2 * N_TURNS, 0.2, N_SAMPLES);
    final TransposedDataSet transposedDataSet1 = TransposedDataSet.transpose(dataSet1, false);
    renderer.getDatasets().add(transposedDataSet1);

    // init default 3D Chart with HeatMapRenderer
    final XYChart chart2 = getDefaultChart();
    final ContourDataSetRenderer contourRenderer = new ContourDataSetRenderer();
    chart2.getRenderers().setAll(contourRenderer);

    final DataSet dataSet2 = createTestData();
    dataSet2.getAxisDescription(DIM_X).set("x-axis", "x-unit");
    dataSet2.getAxisDescription(DIM_Y).set("y-axis", "y-unit");
    final TransposedDataSet transposedDataSet2 = TransposedDataSet.transpose(dataSet2, false);
    contourRenderer.getDatasets().add(transposedDataSet2);

    // init ToolBar items to illustrate the two different methods to flip the DataSet
    final CheckBox cbTransposed = new CheckBox("flip data set");
    final TextField textPermutation = new TextField("0,1,2");
    textPermutation.setPrefWidth(100);
    cbTransposed.setTooltip(new Tooltip("press to transpose DataSet"));
    cbTransposed.setGraphic(new Glyph(FONT_AWESOME, FONT_SYMBOL_TRANSPOSE).size(FONT_SIZE));
    final Button bApplyPermutation = new Button(null, new Glyph(FONT_AWESOME, FONT_SYMBOL_CHECK).size(FONT_SIZE));
    bApplyPermutation.setTooltip(new Tooltip("press to apply permutation"));

    // flipping method #1: via 'setTransposed(boolean)' - flips only first two axes
    cbTransposed.setOnAction(evt -> {
        if (LOGGER.isInfoEnabled()) {
            LOGGER.atInfo().addArgument(cbTransposed.isSelected()).log("set transpose state to '{}'");
        }
        transposedDataSet1.setTransposed(cbTransposed.isSelected());
        transposedDataSet2.setTransposed(cbTransposed.isSelected());
        textPermutation.setText(Arrays.stream(transposedDataSet2.getPermutation()).boxed().map(String::valueOf).collect(Collectors.joining(",")));
    });

    // flipping method #2: via 'setPermutation(int[])' - flips arbitrary combination of axes
    final Runnable permutationAction = () -> {
        final int[] parsedInt1 = Arrays.asList(textPermutation.getText().split(","))
                                         .subList(0, transposedDataSet1.getDimension())
                                         .stream()
                                         .map(String::trim)
                                         .mapToInt(Integer::parseInt)
                                         .toArray();
        final int[] parsedInt2 = Arrays.asList(textPermutation.getText().split(","))
                                         .subList(0, transposedDataSet2.getDimension())
                                         .stream()
                                         .map(String::trim)
                                         .mapToInt(Integer::parseInt)
                                         .toArray();

        transposedDataSet1.setPermutation(parsedInt1);
        transposedDataSet2.setPermutation(parsedInt2);
    };

    textPermutation.setOnAction(evt -> permutationAction.run());
    bApplyPermutation.setOnAction(evt -> permutationAction.run());

    // the usual JavaFX Application boiler-plate code
    final ToolBar toolBar = new ToolBar(new Label("method #1 - transpose: "), cbTransposed, new Separator(),
            new Label("method #2 - permutation: "), textPermutation, bApplyPermutation);
    final HBox hBox = new HBox(chart1, chart2);

    VBox.setVgrow(hBox, Priority.ALWAYS);
    final Scene scene = new Scene(new VBox(toolBar, hBox), 800, 600);
    primaryStage.setTitle(getClass().getSimpleName());
    primaryStage.setScene(scene);
    primaryStage.show();
    primaryStage.setOnCloseRequest(evt -> Platform.exit());
}
 
Example 7
Source File: SnowFlakeSample.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
@Override
public void start(final Stage primaryStage) {
    final XYChart chart1 = getChristmasChart(false);
    final XYChart chart2 = getChristmasChart(true);

    final CheckBox cbTransposed = new CheckBox("flip tree");
    cbTransposed.setTooltip(new Tooltip("press to flip tree"));
    cbTransposed.setGraphic(new Glyph(FONT_AWESOME, FONT_SYMBOL_TRANSPOSE).size(FONT_SIZE));
    cbTransposed.selectedProperty().bindBidirectional(flipProperty);

    final CheckBox cbSnow = new CheckBox("snow");
    cbSnow.setTooltip(new Tooltip("press to switch on/off snow"));
    cbSnow.setGraphic(new Glyph(FONT_AWESOME, FONT_SYMBOL_SNOW).size(FONT_SIZE));
    cbSnow.selectedProperty().bindBidirectional(snowProperty);

    Slider nFlakeSpeed = new Slider(0.0, 2, velocityProperty.get());
    nFlakeSpeed.setBlockIncrement(0.1);
    nFlakeSpeed.setMajorTickUnit(0.1);
    velocityProperty.bind(nFlakeSpeed.valueProperty());

    Spinner<Integer> nSnowFlakes = new Spinner<>(10, 1000, 200, numberOfFlakesProperty.get());
    numberOfFlakesProperty.bind(nSnowFlakes.valueProperty());

    Spinner<Double> meanFlakeSize = new Spinner<>(0.1, 20.0, meanSizeProperty.get(), 0.1);
    meanSizeProperty.bind(meanFlakeSize.valueProperty());

    Spinner<Double> rmsFlakeSize = new Spinner<>(0.1, 20.0, rmsSizeProperty.get(), 0.1);
    rmsSizeProperty.bind(rmsFlakeSize.valueProperty());

    final ToolBar toolBar = new ToolBar(cbTransposed, cbSnow, new Label("speed:"), nFlakeSpeed, //
            new Label("n-flakes:"), nSnowFlakes, new Label("mean-size:"), meanFlakeSize, //
            new Label("rms-size:"), rmsFlakeSize);
    final HBox hBox = new HBox(chart1, chart2);

    VBox.setVgrow(hBox, Priority.ALWAYS);
    final Scene scene = new Scene(new VBox(toolBar, hBox), WIDTH, HEIGHT);

    primaryStage.setTitle(SnowFlakeSample.class.getSimpleName());
    primaryStage.setOnCloseRequest(evt -> Platform.exit());
    primaryStage.setScene(scene);
    primaryStage.show();
    if (LOGGER.isDebugEnabled()) {
        LOGGER.atDebug().log("scene initialised");
    }
}
 
Example 8
Source File: ChannelInformation.java    From paintera with GNU General Public License v2.0 4 votes vote down vote up
private static Optional<int[]> everyNth(int k) {

		if (k == 0)
			 return Optional.empty();

		final NumberField<IntegerProperty> step = NumberField.intField(1, i -> i > 0, ObjectField.SubmitOn.ENTER_PRESSED, ObjectField.SubmitOn.FOCUS_LOST);
		final NumberField<IntegerProperty> start = NumberField.intField(0, i -> i >= 0 && i < k, ObjectField.SubmitOn.ENTER_PRESSED, ObjectField.SubmitOn.FOCUS_LOST);
		final NumberField<IntegerProperty> stop  = NumberField.intField(k, i -> i >= 0 && i < k, ObjectField.SubmitOn.ENTER_PRESSED, ObjectField.SubmitOn.FOCUS_LOST);

		final GridPane grid = new GridPane();
		grid.add(new Label("Start"), 1, 1);
		grid.add(new Label("Stop"), 1, 2);
		grid.add(new Label("Step"), 1, 3);
		grid.add(start.getTextField(), 2, 1);
		grid.add(stop.getTextField(), 2, 2);
		grid.add(step.getTextField(), 2, 3);

		final CheckBox revert = new CheckBox("_Revert");
		revert.setTooltip(new Tooltip("Revert order in which channels are added"));

		final Alert dialog = PainteraAlerts.alert(Alert.AlertType.CONFIRMATION, true);
		dialog.setHeaderText("Select subset of channels: {start, start + step, ...}. The start value is inclusive, stop is exclusive. And start has to be larger than stop.");
		final Button OK = ((Button)dialog.getDialogPane().lookupButton(ButtonType.OK));
		final Button CANCEL = ((Button)dialog.getDialogPane().lookupButton(ButtonType.CANCEL));
		// always submit all text fields when hitting enter.
		OK.setOnAction(e -> {
			step.submit();
			start.submit();
			stop.submit();
		});
		OK.setText("_Ok");
		CANCEL.setText("_Cancel");

		start.valueProperty().addListener((obs, oldv, newv) -> OK.setDisable(newv.intValue() >= stop.valueProperty().get()));
		stop.valueProperty().addListener((obs, oldv, newv) -> OK.setDisable(newv.intValue() <= start.valueProperty().get()));

		dialog.getDialogPane().setContent(new VBox(grid, revert));

		if (dialog.showAndWait().filter(ButtonType.OK::equals).isPresent()) {
			final int inc = step.valueProperty().get();
			final int s = start.valueProperty().get();
			final int S = stop.valueProperty().get();
			final int[] array = new int[(int)Math.ceil((S - s) * 1.0 / inc)];
			LOG.debug("start={} stop={} step={}", s, S, inc);
			for (int i = 0, v = s; v < S; v += inc, ++i)
				array[i] = v;
			LOG.debug("Every nth array: {} {}", array, revert.isSelected());
			return Optional.of(revert.isSelected() ? reverted(array) : array);
		}

		return Optional.empty();

	}
 
Example 9
Source File: AddPVDialog.java    From phoebus with Eclipse Public License 1.0 4 votes vote down vote up
private Node createContent(final Model model, final int count)
{
    final GridPane layout = new GridPane();
    // layout.setGridLinesVisible(true);
    layout.setHgap(5);
    layout.setVgap(5);
    final ColumnConstraints stay = new ColumnConstraints();
    final ColumnConstraints fill = new ColumnConstraints();
    fill.setHgrow(Priority.ALWAYS);
    layout.getColumnConstraints().addAll(stay, stay, fill);

    axis_options = FXCollections.observableArrayList(model.getAxes().stream().map(AxisConfig::getName).collect(Collectors.toList()));
    axis_options.add(0, Messages.AddPV_NewOrEmptyAxis);

    int row = -1;
    for (int i=0; i<count; ++i)
    {
        final String nm = count == 1 ? Messages.Name : Messages.Name + " " + (i+1);
        layout.add(new Label(nm), 0, ++row);
        final TextField name = new TextField();
        name.textProperty().addListener(event -> checkDuplicateName(name));
        name.setTooltip(new Tooltip(formula ? Messages.AddFormula_NameTT : Messages.AddPV_NameTT));
        if (! formula)
            PVAutocompleteMenu.INSTANCE.attachField(name);
        names.add(name);
        layout.add(name, 1, row, 2, 1);

        if (! formula)
        {
            layout.add(new Label(Messages.AddPV_Period), 0, ++row);
            final TextField period = new TextField(Double.toString(Preferences.scan_period));
            period.setTooltip(new Tooltip(Messages.AddPV_PeriodTT));
            periods.add(period);
            period.setDisable(true);
            layout.add(period, 1, row);

            final CheckBox monitor = new CheckBox(Messages.AddPV_OnChange);
            monitor.setTooltip(new Tooltip(Messages.AddPV_OnChangeTT));
            monitor.setSelected(true);
            monitors.add(monitor);
            monitor.setOnAction(event -> period.setDisable(monitor.isSelected()));
            layout.add(monitors.get(i), 2, row);
        }

        layout.add(new Label(Messages.AddPV_Axis), 0, ++row);
        final ChoiceBox<String> axis = new ChoiceBox<>(axis_options);
        axis.setTooltip(new Tooltip(Messages.AddPV_AxisTT));
        axis.getSelectionModel().select(0);
        axes.add(axis);
        layout.add(axes.get(i), 1, row);

        layout.add(new Separator(), 0, ++row, 3, 1);
    }
    return layout;
}
 
Example 10
Source File: HighlightOptions.java    From LogFX with GNU General Public License v3.0 4 votes vote down vote up
public HighlightOptions( SimpleObjectProperty<LogLineColors> standardLogColors,
                         ObservableList<HighlightExpression> observableExpressions,
                         BooleanProperty isFilterEnabled ) {
    this.standardLogColors = standardLogColors;
    this.observableExpressions = observableExpressions;
    this.isFilterEnabled = isFilterEnabled;
    this.expressionsBox = new VBox( 2 );

    expressionsBox.getChildren().addAll( observableExpressions.stream()
            .map( ex -> new HighlightExpressionRow( ex, observableExpressions, expressionsBox ) )
            .toArray( HighlightExpressionRow[]::new ) );

    setSpacing( 5 );
    setPadding( new Insets( 5 ) );
    Label headerLabel = new Label( "Enter highlight expressions:" );
    headerLabel.setFont( Font.font( "Lucida", FontWeight.BOLD, 14 ) );

    CheckBox enableFilter = new CheckBox( "Filter?" );
    enableFilter.selectedProperty().bindBidirectional( isFilterEnabled );
    enableFilter.setTooltip( new Tooltip( "Filter log lines that match selected rules" ) );

    Node helpIcon = createHelpIcon();

    HBox headerRow = new HBox( 10 );
    headerRow.getChildren().addAll( headerLabel, helpIcon );

    BorderPane headerPane = new BorderPane();
    headerPane.setLeft( headerRow );
    headerPane.setRight( enableFilter );

    BorderPane buttonsPane = new BorderPane();

    Button newRow = new Button( "Add rule" );
    newRow.setOnAction( this::addRow );

    Button selectAllFilters = new Button( "All" );
    selectAllFilters.setOnAction( ( event ) -> enableFilters( true ) );
    Button disableAllFilters = new Button( "None" );
    disableAllFilters.setOnAction( ( event ) -> enableFilters( false ) );

    HBox filterButtons = new HBox( 5, new Label( "Select Filters:" ),
            selectAllFilters, disableAllFilters );

    buttonsPane.setLeft( newRow );
    buttonsPane.setRight( filterButtons );

    getChildren().addAll(
            headerPane,
            expressionsBox,
            new StandardLogColorsRow( standardLogColors ),
            buttonsPane );
}