javafx.scene.control.Label#setTooltip ( )源码实例Demo

下面列出了javafx.scene.control.Label#setTooltip ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: pmd-designer   文件: NodeDetailPaneController.java
@Override
protected void beforeParentInit() {
    additionalInfoListView.setPlaceholder(new Label("No additional info"));

    Val<Node> currentSelection = initNodeSelectionHandling(getDesignerRoot(), EventStreams.never(), false);

    // pin to see updates
    currentSelection.pin();

    hideCommonAttributesProperty()
        .values()
        .distinct()
        .subscribe(show -> setFocusNode(currentSelection.getValue(), new DataHolder()));


    attrValueColumn.setCellValueFactory(param -> Val.constant(DesignerUtil.attrToXpathString(param.getValue())));
    attrNameColumn.setCellValueFactory(param -> Val.constant("@" + param.getValue().getName()));
    attrNameColumn.setCellFactory(col -> new AttributeNameTableCell());

    Label valueColGraphic = new Label("Value");
    valueColGraphic.setTooltip(new Tooltip("This is the XPath 2.0 representation"));
    attrValueColumn.setGraphic(valueColGraphic);
}
 
源代码2 项目: chart-fx   文件: DataSetMeasurements.java
protected void addGraphBelowItems() {
    final String toolTip = "whether to draw the new DataSet below (checked) or above (un-checked) the existing DataSets";
    final Label label = new Label("draw below: ");
    label.setTooltip(new Tooltip(toolTip));
    GridPane.setConstraints(label, 0, lastLayoutRow);
    graphBelowOtherDataSets.setSelected(false);
    graphBelowOtherDataSets.setTooltip(new Tooltip(toolTip));
    GridPane.setConstraints(graphBelowOtherDataSets, 1, lastLayoutRow++);

    graphBelowOtherDataSets.selectedProperty().addListener((obs, o, n) -> {
        final Chart chart = localChart.get();
        if (chart == null) {
            return;
        }
        chart.getRenderers().remove(renderer);
        if (Boolean.TRUE.equals(n)) {
            chart.getRenderers().add(0, renderer);
        } else {
            chart.getRenderers().add(renderer);
        }
    });

    this.getDialogContentBox().getChildren().addAll(label, graphBelowOtherDataSets);
}
 
源代码3 项目: phoebus   文件: SnapshotTreeTable.java
private void setup(String text, String tooltip, int minWidth, int prefWidth, boolean resizable) {
            label = new Label(text);
            label.setTooltip(new Tooltip(tooltip));
            label.setTextAlignment(TextAlignment.CENTER);
            setGraphic(label);

            if (minWidth != -1) {
                setMinWidth(minWidth);
            }
            if (prefWidth != -1) {
                setPrefWidth(prefWidth);
            }
            setResizable(resizable);
//            setOnEditStart(e -> controller.suspend());
//            setOnEditCancel(e -> controller.resume());
//            setOnEditCommit(e -> controller.resume());
            this.text = text;
        }
 
源代码4 项目: phoebus   文件: SnapshotTable.java
private void setup(String text, String tooltip, int minWidth, int prefWidth, boolean resizable) {
            label = new Label(text);
            label.setTooltip(new Tooltip(tooltip));
            label.setTextAlignment(TextAlignment.CENTER);
            setGraphic(label);

            if (minWidth != -1) {
                setMinWidth(minWidth);
            }
            if (prefWidth != -1) {
                setPrefWidth(prefWidth);
            }
            setResizable(resizable);
//            setOnEditStart(e -> controller.suspend());
//            setOnEditCancel(e -> controller.resume());
//            setOnEditCommit(e -> controller.resume());
            this.text = text;
        }
 
源代码5 项目: HubTurbo   文件: PickerLabel.java
@Override
public Node getNode() {
    // actual name for labels at the top, add tick for selected labels
    Label label = new Label((canDisplayFullName ? getFullName() : getShortName()));
    setLabelStyle(label);
    label.setText(label.getText() + (!canDisplayFullName && isSelected ? " ✓" : ""));

    FontLoader fontLoader = Toolkit.getToolkit().getFontLoader();
    double width = fontLoader.computeStringWidth(label.getText(), label.getFont());
    label.setPrefWidth(width + 30);

    if (isInGroup()) {
        Tooltip groupTooltip = new Tooltip(getGroupName());
        label.setTooltip(groupTooltip);
    }

    setupEvents(label);
    return label;
}
 
源代码6 项目: pmd-designer   文件: NodeEditionCodeArea.java
@NonNull
public Label buildExpectedLabel(IntFunction<Val<Integer>> numViolationsPerLine, int idx) {
    Label foo = new Label();
    foo.getStyleClass().addAll("num-violations-gutter-label");
    Val<Integer> num = numViolationsPerLine.apply(idx + 1);
    foo.textProperty().bind(num.map(Object::toString));
    foo.setTooltip(new Tooltip("Number of violations expected on this line"));
    foo.visibleProperty().bind(num.map(it -> it > 0));
    return foo;
}
 
源代码7 项目: mzmine3   文件: SpectralMatchPanelFX.java
private GridPane createTitlePane() {
  pnTitle = new GridPane();
  pnTitle.setAlignment(Pos.CENTER);

  // create Top panel
  double simScore = hit.getSimilarity().getScore();
  Color gradientCol = FxColorUtil.awtColorToFX(ColorScaleUtil
      .getColor(FxColorUtil.fxColorToAWT(MIN_COS_COLOR), FxColorUtil.fxColorToAWT(MAX_COS_COLOR),
          MIN_COS_COLOR_VALUE, MAX_COS_COLOR_VALUE, simScore));
  pnTitle.setBackground(
      new Background(new BackgroundFill(gradientCol, CornerRadii.EMPTY, Insets.EMPTY)));

  lblHit = new Label(hit.getName());
  lblHit.getStyleClass().add("white-larger-label");

  lblScore = new Label(COS_FORM.format(simScore));
  lblScore.getStyleClass().add("white-score-label");
  lblScore
      .setTooltip(new Tooltip("Cosine similarity of raw data scan (top, blue) and database scan: "
          + COS_FORM.format(simScore)));

  pnTitle.add(lblHit, 0, 0);
  pnTitle.add(lblScore, 1, 0);
  ColumnConstraints ccTitle0 = new ColumnConstraints(150, -1, -1, Priority.ALWAYS, HPos.LEFT,
      true);
  ColumnConstraints ccTitle1 = new ColumnConstraints(150, 150, 150, Priority.NEVER, HPos.LEFT,
      false);
  pnTitle.getColumnConstraints().add(0, ccTitle0);
  pnTitle.getColumnConstraints().add(1, ccTitle1);

  return pnTitle;
}
 
源代码8 项目: chart-fx   文件: DataSetMeasurements.java
protected void addParameterValueEditorItems() {
    if (measType.getControlParameterNames().isEmpty()) {
        return;
    }
    final String toolTip = "math function parameter - usually in units of the x-axis";
    for (String controlParameter : measType.getControlParameterNames()) {
        final Label label = new Label(controlParameter + ": "); // NOPMD - done only once
        final CheckedNumberTextField parameterField = new CheckedNumberTextField(1.0); // NOPMD - done only once
        label.setTooltip(new Tooltip(toolTip)); // NOPMD - done only once
        GridPane.setConstraints(label, 0, lastLayoutRow);
        parameterField.setTooltip(new Tooltip(toolTip)); // NOPMD - done only once
        GridPane.setConstraints(parameterField, 1, lastLayoutRow++);

        this.parameterFields.add(parameterField);
        this.getDialogContentBox().getChildren().addAll(label, parameterField);
    }
    switch (measType) {
    case TRENDING_SECONDS:
    case TRENDING_TIMEOFDAY_UTC:
    case TRENDING_TIMEOFDAY_LOCAL:
        parameterFields.get(0).setText("600.0");
        parameterFields.get(1).setText("10000");
        Button resetButton = new Button("reset history");
        resetButton.setTooltip(new Tooltip("press to reset trending history"));
        resetButton.setOnAction(evt -> this.trendingDataSet.reset());
        GridPane.setConstraints(resetButton, 1, lastLayoutRow++);
        this.getDialogContentBox().getChildren().addAll(resetButton);
        break;
    default:
        break;
    }
}
 
源代码9 项目: scenic-view   文件: StatusBar.java
private Label createLabel(final String value, final Tooltip tooltip) {
    final Label label = new Label(value);
    label.getStyleClass().add("value-name");
    if (tooltip != null) {
        label.setTooltip(tooltip);
    }
    return label;
}
 
源代码10 项目: bisq   文件: MainView.java
private void updateMarketPriceLabel(Label label) {
    if (model.getIsPriceAvailable().get()) {
        if (model.getIsExternallyProvidedPrice().get()) {
            label.setText(Res.get("mainView.marketPriceWithProvider.label", getPriceProvider()));
            label.setTooltip(new Tooltip(getPriceProviderTooltipString()));
        } else {
            label.setText(Res.get("mainView.marketPrice.bisqInternalPrice"));
            final Tooltip tooltip = new Tooltip(Res.get("mainView.marketPrice.tooltip.bisqInternalPrice"));
            label.setTooltip(tooltip);
        }
    } else {
        label.setText("");
        label.setTooltip(null);
    }
}
 
源代码11 项目: bisq   文件: TextFieldWithCopyIcon.java
public TextFieldWithCopyIcon(String customStyleClass) {
    Label copyIcon = new Label();
    copyIcon.setLayoutY(3);
    copyIcon.getStyleClass().addAll("icon", "highlight");
    copyIcon.setTooltip(new Tooltip(Res.get("shared.copyToClipboard")));
    AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
    copyIcon.setOnMouseClicked(e -> {
        String text = getText();
        if (text != null && text.length() > 0) {
            String copyText;
            if (copyWithoutCurrencyPostFix) {
                String[] strings = text.split(" ");
                if (strings.length > 1)
                    copyText = strings[0]; // exclude the BTC postfix
                else
                    copyText = text;
            } else {
                copyText = text;
            }
            Utilities.copyToClipboard(copyText);
        }
    });
    textField = new JFXTextField();
    textField.setEditable(false);
    if (customStyleClass != null) textField.getStyleClass().add(customStyleClass);
    textField.textProperty().bindBidirectional(text);
    AnchorPane.setRightAnchor(copyIcon, 5.0);
    AnchorPane.setRightAnchor(textField, 30.0);
    AnchorPane.setLeftAnchor(textField, 0.0);
    textField.focusTraversableProperty().set(focusTraversableProperty().get());
    //TODO app wide focus
    //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());

    getChildren().addAll(textField, copyIcon);
}
 
源代码12 项目: bisq   文件: TxIdTextField.java
public TxIdTextField() {
    txConfidenceIndicator = new TxConfidenceIndicator();
    txConfidenceIndicator.setFocusTraversable(false);
    txConfidenceIndicator.setMaxSize(20, 20);
    txConfidenceIndicator.setId("funds-confidence");
    txConfidenceIndicator.setLayoutY(1);
    txConfidenceIndicator.setProgress(0);
    txConfidenceIndicator.setVisible(false);
    AnchorPane.setRightAnchor(txConfidenceIndicator, 0.0);
    AnchorPane.setTopAnchor(txConfidenceIndicator, 3.0);
    progressIndicatorTooltip = new Tooltip("-");
    txConfidenceIndicator.setTooltip(progressIndicatorTooltip);

    copyIcon = new Label();
    copyIcon.setLayoutY(3);
    copyIcon.getStyleClass().addAll("icon", "highlight");
    copyIcon.setTooltip(new Tooltip(Res.get("txIdTextField.copyIcon.tooltip")));
    AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
    AnchorPane.setRightAnchor(copyIcon, 30.0);

    Tooltip tooltip = new Tooltip(Res.get("txIdTextField.blockExplorerIcon.tooltip"));

    blockExplorerIcon = new Label();
    blockExplorerIcon.getStyleClass().addAll("icon", "highlight");
    blockExplorerIcon.setTooltip(tooltip);
    AwesomeDude.setIcon(blockExplorerIcon, AwesomeIcon.EXTERNAL_LINK);
    blockExplorerIcon.setMinWidth(20);
    AnchorPane.setRightAnchor(blockExplorerIcon, 52.0);
    AnchorPane.setTopAnchor(blockExplorerIcon, 4.0);

    textField = new JFXTextField();
    textField.setId("address-text-field");
    textField.setEditable(false);
    textField.setTooltip(tooltip);
    AnchorPane.setRightAnchor(textField, 80.0);
    AnchorPane.setLeftAnchor(textField, 0.0);
    textField.focusTraversableProperty().set(focusTraversableProperty().get());
    getChildren().addAll(textField, copyIcon, blockExplorerIcon, txConfidenceIndicator);
}
 
源代码13 项目: Open-Lowcode   文件: CObjectArrayField.java
@Override
public Node getNode(
		PageActionManager actionmanager,
		CPageData inputdata,
		Window parentwindow,
		TabPane[] parenttabpanes,
		CollapsibleNode nodetocollapsewhenactiontriggered) {
	logger.fine("built node CObjectArrayField " + this.name);
	this.actionmanager = actionmanager;
	if (this.inlinefeeding) {
		inputdata.addInlineActionDataRef(this.feedinginlineactionoutputdata);

	}
	this.tooltip = new Tooltip("click to open object\nShift+click to unlink object.");
	HBox thispane = new HBox();

	if (label != null)
		if (label.length() > 0) {
			Label thislabel = new Label(label);
			if (helper != null)
				if (helper.length() > 0)
					thislabel.setTooltip(new Tooltip(helper));
			thislabel.setFont(
					Font.font(thislabel.getFont().getName(), FontPosture.ITALIC, thislabel.getFont().getSize()));
			thislabel.setMinWidth(120);
			thislabel.setWrapText(true);
			thislabel.setMaxWidth(120);
			thispane.getChildren().add(thislabel);
		}

	datapane = new FlowPane();
	boolean nolabel = true;
	if (label != null)
		if (label.length() > 0) {
			FlowPane flowdatapane = new FlowPane();
			thispane.setAlignment(Pos.TOP_LEFT);
			flowdatapane.setPrefWrapLength(400);
			// for object workflow tasks.
			flowdatapane.setVgap(4);
			flowdatapane.setHgap(8);
			this.datapane = flowdatapane;
			nolabel = false;
		}

	if (nolabel) {
		HBox boxdatapane = new HBox();
		thispane.setAlignment(Pos.CENTER_LEFT);
		boxdatapane.setAlignment(Pos.CENTER_LEFT);
		this.datapane = boxdatapane;
	}

	// this is to keep the widget tiny when used as right of title

	thiselementarray = getExternalContent(inputdata, datareference);
	if (objectatendoffielddata != null)
		dataatendoffielddata = objectatendoffielddata.getNode(actionmanager, inputdata, parentwindow,
				parenttabpanes,nodetocollapsewhenactiontriggered);
	refreshDisplay();

	thispane.getChildren().add(datapane);

	return thispane;
}
 
源代码14 项目: pmd-designer   文件: SearchableTreeView.java
/**
 * Textfield for the search query.
 */
private void popSearchField() {
    TextField textField = new TextField();
    textField.setPrefWidth(150);
    textField.setPromptText("Search tree");
    ControlUtil.makeTextFieldShowPromptEvenIfFocused(textField);

    Label label = new Label();
    label.getStyleClass().addAll("hint-label");
    label.setTooltip(new Tooltip("Go to next result with F3"));

    StackPane pane = new StackPane();
    pane.getStyleClass().addAll("search-popup");
    pane.getStylesheets().addAll(DesignerUtil.getCss("designer").toString());

    StackPane.setAlignment(textField, Pos.TOP_RIGHT);
    StackPane.setAlignment(label, Pos.BOTTOM_RIGHT);


    pane.getChildren().addAll(textField, label);

    Val<String> query = Val.wrap(textField.textProperty())
                           .filter(StringUtils::isNotBlank).map(String::trim)
                           .filter(it -> it.length() >= MIN_QUERY_LENGTH);

    Var<Integer> numResults = Var.newSimpleVar(0);

    Subscription subscription = bindSearchQuery(query.conditionOnShowing(pane), numResults, textField);

    label.textProperty().bind(
        numResults.map(n -> n == 0 ? "no match" : n == 1 ? "1 match" : n + " matches")
    );

    label.visibleProperty().bind(query.map(Objects::nonNull));

    Popup popup = new Popup();
    popup.getContent().addAll(pane);
    popup.setAutoHide(true);
    popup.setHideOnEscape(true);

    Bounds bounds = localToScreen(getBoundsInLocal());
    popup.show(this, bounds.getMaxX() - textField.getPrefWidth() - 1, bounds.getMinY());
    popup.setOnHidden(e -> {
        openSearchField = null;
        subscription.unsubscribe();
    }); // release resources

    // Hide popup when ENTER or ESCAPE is pressed
    EventStreams.eventsOf(popup, KeyEvent.KEY_RELEASED)
                .filter(it -> it.getCode() == KeyCode.ENTER || it.getCode() == KeyCode.ESCAPE)
                .subscribeForOne(e -> {
                    popup.hide();
                    e.consume();
                });

    textField.requestFocus();
    openSearchField = textField;
}
 
源代码15 项目: chart-fx   文件: WaterfallPerformanceSample.java
private ToolBar getContourToolBar(final XYChart chart, final ContourDataSetRenderer renderer) {
    ToolBar contourToolBar = new ToolBar();

    contourType.getItems().addAll(ContourType.values());
    contourType.setValue(renderer.getContourType());
    contourType.valueProperty().bindBidirectional(renderer.contourTypeProperty());
    contourType.valueProperty().addListener((ch, old, selection) -> chart.requestLayout());

    colorGradient.setValue(renderer.getColorGradient());
    colorGradient.valueProperty().bindBidirectional(renderer.colorGradientProperty());
    colorGradient.valueProperty().addListener((ch, old, selection) -> chart.requestLayout());

    nCountourLevelSlider.setShowTickLabels(true);
    nCountourLevelSlider.setShowTickMarks(true);
    nCountourLevelSlider.setMajorTickUnit(10);
    nCountourLevelSlider.setMinorTickCount(5);
    nCountourLevelSlider.setBlockIncrement(1);
    nCountourLevelSlider.setTooltip(new Tooltip("adjusts number of contour levels"));
    HBox.setHgrow(nCountourLevelSlider, Priority.ALWAYS);
    Label nContourLabel = new Label("n contours:");
    nContourLabel.setTooltip(new Tooltip("adjusts number of contour levels"));
    final HBox hBoxContourLevelSlider = new HBox(nContourLabel, nCountourLevelSlider);
    nCountourLevelSlider.valueProperty().bindBidirectional(renderer.quantisationLevelsProperty());
    nCountourLevelSlider.valueProperty().addListener((ch, o, n) -> chart.requestLayout());

    nSegmentSlider.setShowTickLabels(true);
    nSegmentSlider.setShowTickMarks(true);
    nSegmentSlider.setMajorTickUnit(200);
    nSegmentSlider.setMinorTickCount(50);
    nSegmentSlider.setBlockIncrement(10);
    HBox.setHgrow(nSegmentSlider, Priority.ALWAYS);
    final HBox hBoxSegmentSlider = new HBox(new Label("n segments :"), nSegmentSlider);
    nSegmentSlider.valueProperty().bindBidirectional(renderer.maxContourSegmentsProperty());
    nSegmentSlider.valueProperty().addListener((ch, o, n) -> chart.requestLayout());

    minHexSizeSlider.setShowTickLabels(true);
    minHexSizeSlider.setShowTickMarks(true);
    minHexSizeSlider.setMajorTickUnit(10);
    minHexSizeSlider.setMinorTickCount(10);
    minHexSizeSlider.setBlockIncrement(1);
    HBox.setHgrow(minHexSizeSlider, Priority.ALWAYS);
    final HBox hBoxHexSizeSlider = new HBox(new Label("HexSize :"), minHexSizeSlider);
    minHexSizeSlider.valueProperty().bindBidirectional(renderer.minHexTileSizeProperty());
    minHexSizeSlider.valueProperty().addListener((ch, o, n) -> chart.requestLayout());

    localRange.setSelected(renderer.computeLocalRange());
    localRange.setTooltip(new Tooltip("select for auto-adjusting the colour axis for the selected sub-range"));
    localRange.selectedProperty().bindBidirectional(renderer.computeLocalRangeProperty());
    localRange.selectedProperty().addListener((ch, old, selection) -> chart.requestLayout());

    final ToolBar standardCountourParameters = new ToolBar(contourType, colorGradient, hBoxContourLevelSlider,
            hBoxSegmentSlider, hBoxHexSizeSlider, localRange);

    dataReduction.setSelected(renderer.isReducePoints());
    dataReduction.selectedProperty().bindBidirectional(renderer.pointReductionProperty());
    dataReduction.selectedProperty().addListener((ch, old, selection) -> chart.requestLayout());

    ChangeListener<Integer> reductionListener = (ch, o, n) -> {
        renderer.setReductionFactorX(reductionFactorX.getValue());
        renderer.setReductionFactorY(reductionFactorY.getValue());
        chart.requestLayout();
    };

    reductionFactorX.getValueFactory().setValue(renderer.getReductionFactorX());
    reductionFactorY.getValueFactory().setValue(renderer.getReductionFactorY());
    reductionFactorX.setPrefWidth(80);
    reductionFactorY.setPrefWidth(80);
    reductionFactorX.valueProperty().addListener(reductionListener);
    reductionFactorY.valueProperty().addListener(reductionListener);
    HBox.setHgrow(reductionFactorX, Priority.ALWAYS);
    HBox.setHgrow(reductionFactorY, Priority.ALWAYS);

    final HBox hBoxReductionFactorSlider = new HBox(new Label("Min Data Pixel Size X:"), reductionFactorX,
            new Label(" Y:"), reductionFactorY);

    reductionType.getItems().addAll(ReductionType.values());
    reductionType.setValue(renderer.getReductionType());
    reductionType.valueProperty().bindBidirectional(renderer.reductionTypeProperty());
    reductionType.valueProperty().addListener((ch, old, selection) -> chart.requestLayout());

    smooth.setSelected(renderer.isSmooth());
    smooth.selectedProperty().bindBidirectional(renderer.smoothProperty());
    smooth.selectedProperty().addListener((ch, old, selection) -> chart.requestLayout());

    altImplementation.setSelected(renderer.isAltImplementation());
    altImplementation.selectedProperty().bindBidirectional(renderer.altImplementationProperty());
    altImplementation.selectedProperty().addListener((ch, old, selection) -> chart.requestLayout());

    parallelImplementation.setSelected(renderer.isParallelImplementation());
    parallelImplementation.selectedProperty().bindBidirectional(renderer.parallelImplementationProperty());
    parallelImplementation.selectedProperty().addListener((ch, old, selection) -> chart.requestLayout());

    final ToolBar newCountourParameters = new ToolBar(dataReduction, hBoxReductionFactorSlider, reductionType,
            smooth, altImplementation, parallelImplementation);

    contourToolBar.getItems().addAll(new VBox(standardCountourParameters, newCountourParameters));
    return contourToolBar;
}
 
源代码16 项目: bisq   文件: BsqAddressTextField.java
public BsqAddressTextField() {
    TextField textField = new BisqTextField();
    textField.setId("address-text-field");
    textField.setEditable(false);
    textField.textProperty().bind(address);
    String tooltipText = Res.get("addressTextField.copyToClipboard");
    textField.setTooltip(new Tooltip(tooltipText));

    textField.setOnMousePressed(event -> wasPrimaryButtonDown = event.isPrimaryButtonDown());
    textField.setOnMouseReleased(event -> {
        if (wasPrimaryButtonDown && address.get() != null && address.get().length() > 0) {
            Utilities.copyToClipboard(address.get());
            Notification walletFundedNotification = new Notification()
                    .notification(Res.get("addressTextField.addressCopiedToClipboard"))
                    .hideCloseButton()
                    .autoClose();

            walletFundedNotification.show();
        }

        wasPrimaryButtonDown = false;
    });

    textField.focusTraversableProperty().set(focusTraversableProperty().get());
    //TODO app wide focus
    //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());


    Label copyIcon = new Label();
    copyIcon.setLayoutY(3);
    copyIcon.getStyleClass().addAll("icon", "highlight");
    copyIcon.setTooltip(new Tooltip(Res.get("addressTextField.copyToClipboard")));
    AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
    copyIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> {
        if (address.get() != null && address.get().length() > 0)
            Utilities.copyToClipboard(address.get());
    }));

    AnchorPane.setRightAnchor(copyIcon, 5.0);
    AnchorPane.setRightAnchor(textField, 30.0);
    AnchorPane.setLeftAnchor(textField, 0.0);

    getChildren().addAll(textField, copyIcon);
}
 
源代码17 项目: bisq   文件: AddressTextField.java
public AddressTextField(String label) {
    JFXTextField textField = new BisqTextField();
    textField.setId("address-text-field");
    textField.setEditable(false);
    textField.setLabelFloat(true);
    textField.setPromptText(label);

    textField.textProperty().bind(address);
    String tooltipText = Res.get("addressTextField.openWallet");
    textField.setTooltip(new Tooltip(tooltipText));

    textField.setOnMousePressed(event -> wasPrimaryButtonDown = event.isPrimaryButtonDown());
    textField.setOnMouseReleased(event -> {
        if (wasPrimaryButtonDown)
            GUIUtil.showFeeInfoBeforeExecute(AddressTextField.this::openWallet);

        wasPrimaryButtonDown = false;
    });

    textField.focusTraversableProperty().set(focusTraversableProperty().get());
    //TODO app wide focus
    //focusedProperty().addListener((ov, oldValue, newValue) -> textField.requestFocus());

    Label extWalletIcon = new Label();
    extWalletIcon.setLayoutY(3);
    extWalletIcon.getStyleClass().addAll("icon", "highlight");
    extWalletIcon.setTooltip(new Tooltip(tooltipText));
    AwesomeDude.setIcon(extWalletIcon, AwesomeIcon.SIGNIN);
    extWalletIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(this::openWallet));

    Label copyIcon = new Label();
    copyIcon.setLayoutY(3);
    copyIcon.getStyleClass().addAll("icon", "highlight");
    Tooltip.install(copyIcon, new Tooltip(Res.get("addressTextField.copyToClipboard")));
    AwesomeDude.setIcon(copyIcon, AwesomeIcon.COPY);
    copyIcon.setOnMouseClicked(e -> GUIUtil.showFeeInfoBeforeExecute(() -> {
        if (address.get() != null && address.get().length() > 0)
            Utilities.copyToClipboard(address.get());
    }));

    AnchorPane.setRightAnchor(copyIcon, 30.0);
    AnchorPane.setRightAnchor(extWalletIcon, 5.0);
    AnchorPane.setRightAnchor(textField, 55.0);
    AnchorPane.setLeftAnchor(textField, 0.0);

    getChildren().addAll(textField, copyIcon, extWalletIcon);
}
 
源代码18 项目: pmd-designer   文件: PropertyMapView.java
@Override
protected Pair<Node, Subscription> getNonEditingGraphic(Pair<PropertyDescriptorSpec, Var<String>> pair) {

    setEditable(true);

    Subscription sub = Subscription.EMPTY;

    Label propName = new Label();
    propName.textProperty().bind(pair.getKey().nameProperty());

    sub = sub.and(() -> propName.textProperty().unbind());

    Label sep = new Label(" → ");


    Label propValue = new Label();
    propValue.textProperty().bind(pair.getValue());

    sub = sub.and(() -> propValue.textProperty().unbind());

    Pane spacer = new Pane();
    HBox.setHgrow(spacer, Priority.ALWAYS);

    FontIcon defaultIcon = new FontIcon("fas-map-marker");
    Label defaultLabel = new Label("", defaultIcon);
    defaultLabel.visibleProperty().bind(
        pair.getValue().flatMap(it -> pair.getKey().valueProperty())
            .map(it -> Objects.equals(it, pair.getValue().getValue()))
    );
    defaultLabel.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
    defaultLabel.setTooltip(new Tooltip("Default value"));

    sub = sub.and(() -> defaultLabel.visibleProperty().unbind());

    HBox box = new HBox();
    box.getChildren().addAll(propName, sep, propValue, spacer, defaultLabel);
    sub = sub.and(ControlUtil.registerDoubleClickListener(box, this::doStartEdit));

    return new Pair<>(box, sub);
}