Java Code Examples for javafx.scene.control.Label#setMouseTransparent()

The following examples show how to use javafx.scene.control.Label#setMouseTransparent() . 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: AddressWithIconAndDirection.java    From bisq with GNU Affero General Public License v3.0 8 votes vote down vote up
public AddressWithIconAndDirection(String text, String address, boolean received) {
    Label directionIcon = new Label();
    directionIcon.getStyleClass().add("icon");
    directionIcon.getStyleClass().add(received ? "received-funds-icon" : "sent-funds-icon");
    AwesomeDude.setIcon(directionIcon, received ? AwesomeIcon.SIGNIN : AwesomeIcon.SIGNOUT);
    if (received)
        directionIcon.setRotate(180);
    directionIcon.setMouseTransparent(true);

    setAlignment(Pos.CENTER_LEFT);
    Label label = new AutoTooltipLabel(text);
    label.setMouseTransparent(true);
    HBox.setMargin(directionIcon, new Insets(0, 3, 0, 0));
    HBox.setHgrow(label, Priority.ALWAYS);

    hyperlink = new ExternalHyperlink(address);
    HBox.setMargin(hyperlink, new Insets(0));
    HBox.setHgrow(hyperlink, Priority.SOMETIMES);
    // You need to set max width to Double.MAX_VALUE to make HBox.setHgrow working like expected!
    // also pref width needs to be not default (-1)
    hyperlink.setMaxWidth(Double.MAX_VALUE);
    hyperlink.setPrefWidth(0);

    getChildren().addAll(directionIcon, label, hyperlink);
}
 
Example 2
Source File: Tracker.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
private Label createLabel(final TextAlignment talign, final Pos align)
{
    // Initial text is used to determine size
    final Label lbl = new Label("\u00A0\u00A000, 00\u00A0\u00A0");

    lbl.getStyleClass().add("location_size");
    lbl.setTextAlignment(talign);
    lbl.setAlignment(align);
    // When clicking/dragging the tracker,
    // don't allow the label to capture mouse clicks.
    lbl.setMouseTransparent(true);

    return lbl;
}
 
Example 3
Source File: QRCodeWindow.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void show() {
    createGridPane();
    addHeadLine();
    addMessage();

    GridPane.setRowIndex(qrCodeImageView, ++rowIndex);
    GridPane.setColumnSpan(qrCodeImageView, 2);
    GridPane.setHalignment(qrCodeImageView, HPos.CENTER);
    gridPane.getChildren().add(qrCodeImageView);

    String request = bitcoinURI.replace("%20", " ").replace("?", "\n?").replace("&", "\n&");
    Label infoLabel = new AutoTooltipLabel(Res.get("qRCodeWindow.request", request));
    infoLabel.setMouseTransparent(true);
    infoLabel.setWrapText(true);
    infoLabel.setId("popup-qr-code-info");
    GridPane.setHalignment(infoLabel, HPos.CENTER);
    GridPane.setHgrow(infoLabel, Priority.ALWAYS);
    GridPane.setMargin(infoLabel, new Insets(3, 0, 0, 0));
    GridPane.setRowIndex(infoLabel, ++rowIndex);
    GridPane.setColumnIndex(infoLabel, 0);
    GridPane.setColumnSpan(infoLabel, 2);
    gridPane.getChildren().add(infoLabel);

    addButtons();
    applyStyles();
    display();
}
 
Example 4
Source File: TakeOfferView.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
private VBox getTradeFeeFieldsBox() {
    tradeFeeInBtcLabel = new Label();
    tradeFeeInBtcLabel.setMouseTransparent(true);
    tradeFeeInBtcLabel.setId("trade-fee-textfield");

    tradeFeeInBsqLabel = new Label();
    tradeFeeInBsqLabel.setMouseTransparent(true);
    tradeFeeInBsqLabel.setId("trade-fee-textfield");

    VBox vBox = new VBox();
    vBox.setSpacing(6);
    vBox.setMaxWidth(300);
    vBox.setAlignment(DevEnv.isDaoActivated() ? Pos.CENTER_RIGHT : Pos.CENTER_LEFT);
    vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);

    tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
    tradeFeeInBtcToggle.setText("BTC");
    tradeFeeInBtcToggle.setPadding(new Insets(-8, 5, -10, 5));

    tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton();
    tradeFeeInBsqToggle.setText("BSQ");
    tradeFeeInBsqToggle.setPadding(new Insets(-9, 5, -9, 5));

    VBox tradeFeeToggleButtonBox = new VBox();
    tradeFeeToggleButtonBox.getChildren().addAll(tradeFeeInBtcToggle, tradeFeeInBsqToggle);

    HBox hBox = new HBox();
    hBox.getChildren().addAll(vBox, tradeFeeToggleButtonBox);
    hBox.setMinHeight(47);
    hBox.setMaxHeight(hBox.getMinHeight());
    HBox.setHgrow(vBox, Priority.ALWAYS);
    HBox.setHgrow(tradeFeeToggleButtonBox, Priority.NEVER);

    final Tuple2<Label, VBox> tradeInputBox = getTradeInputBox(hBox, Res.get("createOffer.tradeFee.descriptionBSQEnabled"));

    tradeFeeDescriptionLabel = tradeInputBox.first;

    return tradeInputBox.second;
}
 
Example 5
Source File: TextFieldWithIcon.java    From bisq with GNU Affero General Public License v3.0 5 votes vote down vote up
public TextFieldWithIcon() {
    textField = new JFXTextField();
    textField.setEditable(false);
    textField.setMouseTransparent(true);
    textField.setFocusTraversable(false);
    setLeftAnchor(textField, 0d);
    setRightAnchor(textField, 0d);

    dummyTextField = new Label();
    dummyTextField.setWrapText(true);
    dummyTextField.setAlignment(Pos.CENTER_LEFT);
    dummyTextField.setTextAlignment(TextAlignment.LEFT);
    dummyTextField.setMouseTransparent(true);
    dummyTextField.setFocusTraversable(false);
    setLeftAnchor(dummyTextField, 0d);
    dummyTextField.setVisible(false);

    iconLabel = new Label();
    iconLabel.setLayoutX(0);
    iconLabel.setLayoutY(3);

    dummyTextField.widthProperty().addListener((observable, oldValue, newValue) -> {
        iconLabel.setLayoutX(dummyTextField.widthProperty().get() + 20);
    });

    getChildren().addAll(textField, dummyTextField, iconLabel);
}
 
Example 6
Source File: JFXColorPickerSkin.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public JFXColorPickerSkin(final ColorPicker colorPicker) {
    super(colorPicker, new JFXColorPickerBehavior(colorPicker));

    // create displayNode
    displayNode = new Label("");
    displayNode.getStyleClass().add("color-label");
    displayNode.setMouseTransparent(true);

    // label graphic
    colorBox = new JFXClippedPane(displayNode);
    colorBox.getStyleClass().add("color-box");
    colorBox.setManaged(false);
    initColor();
    final JFXRippler rippler = new JFXRippler(colorBox, JFXRippler.RipplerMask.FIT);
    rippler.ripplerFillProperty().bind(displayNode.textFillProperty());
    getChildren().setAll(rippler);
    JFXDepthManager.setDepth(getSkinnable(), 1);
    getSkinnable().setPickOnBounds(false);

    colorPicker.focusedProperty().addListener(observable -> {
        if (colorPicker.isFocused()) {
            if (!getSkinnable().isPressed()) {
                rippler.setOverlayVisible(true);
            }
        } else {
            rippler.setOverlayVisible(false);
        }
    });

    // add listeners
    registerChangeListener(colorPicker.valueProperty(), "VALUE");
    colorLabelVisible.addListener(invalidate -> {
        if (displayNode != null) {
            if (colorLabelVisible.get()) {
                displayNode.setText(JFXNodeUtils.colorToHex(getSkinnable().getValue()));
            } else {
                displayNode.setText("");
            }
        }
    });
}
 
Example 7
Source File: WalletPasswordWindow.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private void showRestoreScreen() {
    Label headLine2Label = new AutoTooltipLabel(Res.get("seed.restore.title"));
    headLine2Label.getStyleClass().add("popup-headline");
    headLine2Label.setMouseTransparent(true);
    GridPane.setHalignment(headLine2Label, HPos.LEFT);
    GridPane.setRowIndex(headLine2Label, ++rowIndex);
    GridPane.setMargin(headLine2Label, new Insets(30, 0, 0, 0));
    gridPane.getChildren().add(headLine2Label);

    seedWordsTextArea = addTextArea(gridPane, ++rowIndex, Res.get("seed.enterSeedWords"), 5);
    ;
    seedWordsTextArea.setPrefHeight(60);

    Tuple2<Label, DatePicker> labelDatePickerTuple2 = addTopLabelDatePicker(gridPane, ++rowIndex,
            Res.get("seed.creationDate"), 10);
    datePicker = labelDatePickerTuple2.second;
    restoreButton = addPrimaryActionButton(gridPane, ++rowIndex, Res.get("seed.restore"), 0);
    restoreButton.setDefaultButton(true);
    stage.setHeight(570);


    // wallet creation date is not encrypted
    LocalDate walletCreationDate = Instant.ofEpochSecond(walletsManager.getChainSeedCreationTimeSeconds()).atZone(ZoneId.systemDefault()).toLocalDate();
    log.info("walletCreationDate " + walletCreationDate);
    datePicker.setValue(walletCreationDate);
    restoreButton.disableProperty().bind(createBooleanBinding(() -> !seedWordsValid.get() || !seedWordsEdited.get(),
            seedWordsValid, seedWordsEdited));

    seedWordsValidChangeListener = (observable, oldValue, newValue) -> {
        if (newValue) {
            seedWordsTextArea.getStyleClass().remove("validation-error");
        } else {
            seedWordsTextArea.getStyleClass().add("validation-error");
        }
    };

    wordsTextAreaChangeListener = (observable, oldValue, newValue) -> {
        seedWordsEdited.set(true);
        try {
            MnemonicCode codec = new MnemonicCode();
            codec.check(Splitter.on(" ").splitToList(newValue));
            seedWordsValid.set(true);
        } catch (IOException | MnemonicException e) {
            seedWordsValid.set(false);
        }
    };

    seedWordsValid.addListener(seedWordsValidChangeListener);
    seedWordsTextArea.textProperty().addListener(wordsTextAreaChangeListener);
    restoreButton.disableProperty().bind(createBooleanBinding(() -> !seedWordsValid.get() || !seedWordsEdited.get(),
            seedWordsValid, seedWordsEdited));

    restoreButton.setOnAction(e -> onRestore());

    seedWordsTextArea.getStyleClass().remove("validation-error");
    datePicker.getStyleClass().remove("validation-error");

    layout();
}
 
Example 8
Source File: MutableOfferView.java    From bisq with GNU Affero General Public License v3.0 4 votes vote down vote up
private VBox getTradeFeeFieldsBox() {
    tradeFeeInBtcLabel = new Label();
    tradeFeeInBtcLabel.setMouseTransparent(true);
    tradeFeeInBtcLabel.setId("trade-fee-textfield");

    tradeFeeInBsqLabel = new Label();
    tradeFeeInBsqLabel.setMouseTransparent(true);
    tradeFeeInBsqLabel.setId("trade-fee-textfield");

    VBox vBox = new VBox();
    vBox.setSpacing(6);
    vBox.setMaxWidth(300);
    vBox.setAlignment(DevEnv.isDaoActivated() ? Pos.CENTER_RIGHT : Pos.CENTER_LEFT);
    vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);

    tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
    tradeFeeInBtcToggle.setText("BTC");
    tradeFeeInBtcToggle.setVisible(false);
    tradeFeeInBtcToggle.setPadding(new Insets(-8, 5, -10, 5));

    tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton();
    tradeFeeInBsqToggle.setText("BSQ");
    tradeFeeInBsqToggle.setVisible(false);
    tradeFeeInBsqToggle.setPadding(new Insets(-9, 5, -9, 5));

    VBox tradeFeeToggleButtonBox = new VBox();
    tradeFeeToggleButtonBox.getChildren().addAll(tradeFeeInBtcToggle, tradeFeeInBsqToggle);

    HBox hBox = new HBox();
    hBox.getChildren().addAll(vBox, tradeFeeToggleButtonBox);
    hBox.setMinHeight(47);
    hBox.setMaxHeight(hBox.getMinHeight());
    HBox.setHgrow(vBox, Priority.ALWAYS);
    HBox.setHgrow(tradeFeeToggleButtonBox, Priority.NEVER);

    final Tuple2<Label, VBox> tradeInputBox = getTradeInputBox(hBox, Res.get("createOffer.tradeFee.descriptionBSQEnabled"));

    tradeFeeDescriptionLabel = tradeInputBox.first;

    return tradeInputBox.second;
}