mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-21 12:48:35 -04:00
fix hand cursor and tooltips for copy buttons
This commit is contained in:
parent
b5801c1cd2
commit
24b2aa5dad
4 changed files with 27 additions and 2 deletions
|
@ -18,12 +18,15 @@
|
||||||
package haveno.desktop.components;
|
package haveno.desktop.components;
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXTextField;
|
import com.jfoenix.controls.JFXTextField;
|
||||||
|
|
||||||
|
import haveno.common.UserThread;
|
||||||
import haveno.common.util.Utilities;
|
import haveno.common.util.Utilities;
|
||||||
import haveno.core.locale.Res;
|
import haveno.core.locale.Res;
|
||||||
import haveno.desktop.util.GUIUtil;
|
import haveno.desktop.util.GUIUtil;
|
||||||
import haveno.desktop.util.Layout;
|
import haveno.desktop.util.Layout;
|
||||||
import javafx.beans.property.SimpleStringProperty;
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
import javafx.beans.property.StringProperty;
|
import javafx.beans.property.StringProperty;
|
||||||
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.Tooltip;
|
import javafx.scene.control.Tooltip;
|
||||||
|
@ -71,6 +74,10 @@ public class TextFieldWithCopyIcon extends AnchorPane {
|
||||||
copyText = text;
|
copyText = text;
|
||||||
}
|
}
|
||||||
Utilities.copyToClipboard(copyText);
|
Utilities.copyToClipboard(copyText);
|
||||||
|
Tooltip tp = new Tooltip(Res.get("shared.copiedToClipboard"));
|
||||||
|
Node node = (Node) e.getSource();
|
||||||
|
UserThread.runAfter(() -> tp.hide(), 1);
|
||||||
|
tp.show(node, e.getScreenX() + Layout.PADDING, e.getScreenY() + Layout.PADDING);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
textField = new JFXTextField();
|
textField = new JFXTextField();
|
||||||
|
|
|
@ -31,6 +31,8 @@ import haveno.desktop.components.indicator.TxConfidenceIndicator;
|
||||||
import haveno.desktop.util.GUIUtil;
|
import haveno.desktop.util.GUIUtil;
|
||||||
import haveno.desktop.util.Layout;
|
import haveno.desktop.util.Layout;
|
||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
|
import javafx.scene.Cursor;
|
||||||
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.TextField;
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.control.Tooltip;
|
import javafx.scene.control.Tooltip;
|
||||||
|
@ -80,6 +82,7 @@ public class TxIdTextField extends AnchorPane {
|
||||||
copyLabel.getStyleClass().addAll("icon", "highlight");
|
copyLabel.getStyleClass().addAll("icon", "highlight");
|
||||||
copyLabel.setTooltip(new Tooltip(Res.get("txIdTextField.copyIcon.tooltip")));
|
copyLabel.setTooltip(new Tooltip(Res.get("txIdTextField.copyIcon.tooltip")));
|
||||||
copyLabel.setGraphic(GUIUtil.getCopyIcon());
|
copyLabel.setGraphic(GUIUtil.getCopyIcon());
|
||||||
|
copyLabel.setCursor(Cursor.HAND);
|
||||||
AnchorPane.setRightAnchor(copyLabel, 30.0);
|
AnchorPane.setRightAnchor(copyLabel, 30.0);
|
||||||
|
|
||||||
Tooltip tooltip = new Tooltip(Res.get("txIdTextField.blockExplorerIcon.tooltip"));
|
Tooltip tooltip = new Tooltip(Res.get("txIdTextField.blockExplorerIcon.tooltip"));
|
||||||
|
@ -159,7 +162,13 @@ public class TxIdTextField extends AnchorPane {
|
||||||
textField.setText(txId);
|
textField.setText(txId);
|
||||||
textField.setOnMouseClicked(mouseEvent -> openBlockExplorer(txId));
|
textField.setOnMouseClicked(mouseEvent -> openBlockExplorer(txId));
|
||||||
blockExplorerIcon.setOnMouseClicked(mouseEvent -> openBlockExplorer(txId));
|
blockExplorerIcon.setOnMouseClicked(mouseEvent -> openBlockExplorer(txId));
|
||||||
copyLabel.setOnMouseClicked(e -> Utilities.copyToClipboard(txId));
|
copyLabel.setOnMouseClicked(e -> {
|
||||||
|
Utilities.copyToClipboard(txId);
|
||||||
|
Tooltip tp = new Tooltip(Res.get("shared.copiedToClipboard"));
|
||||||
|
Node node = (Node) e.getSource();
|
||||||
|
UserThread.runAfter(() -> tp.hide(), 1);
|
||||||
|
tp.show(node, e.getScreenX() + Layout.PADDING, e.getScreenY() + Layout.PADDING);
|
||||||
|
});
|
||||||
txConfidenceIndicator.setVisible(true);
|
txConfidenceIndicator.setVisible(true);
|
||||||
|
|
||||||
// update off main thread
|
// update off main thread
|
||||||
|
|
|
@ -52,6 +52,7 @@ import javafx.geometry.HPos;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.NodeOrientation;
|
import javafx.geometry.NodeOrientation;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
|
import javafx.scene.Cursor;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.PerspectiveCamera;
|
import javafx.scene.PerspectiveCamera;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
|
@ -778,6 +779,7 @@ public abstract class Overlay<T extends Overlay<T>> {
|
||||||
copyLabel.setVisible(true);
|
copyLabel.setVisible(true);
|
||||||
MaterialDesignIconView copyIcon = new MaterialDesignIconView(MaterialDesignIcon.CONTENT_COPY, "1.2em");
|
MaterialDesignIconView copyIcon = new MaterialDesignIconView(MaterialDesignIcon.CONTENT_COPY, "1.2em");
|
||||||
copyLabel.setGraphic(copyIcon);
|
copyLabel.setGraphic(copyIcon);
|
||||||
|
copyLabel.setCursor(Cursor.HAND);
|
||||||
copyLabel.addEventHandler(MOUSE_CLICKED, mouseEvent -> {
|
copyLabel.addEventHandler(MOUSE_CLICKED, mouseEvent -> {
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
Utilities.copyToClipboard(getClipboardText());
|
Utilities.copyToClipboard(getClipboardText());
|
||||||
|
|
|
@ -69,6 +69,7 @@ import javafx.geometry.HPos;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.geometry.VPos;
|
import javafx.geometry.VPos;
|
||||||
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.ContentDisplay;
|
import javafx.scene.control.ContentDisplay;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
@ -426,7 +427,13 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
||||||
JFXButton copyButton = new JFXButton(Res.get("offerDetailsWindow.challenge.copy"), copyLabel);
|
JFXButton copyButton = new JFXButton(Res.get("offerDetailsWindow.challenge.copy"), copyLabel);
|
||||||
copyButton.setContentDisplay(ContentDisplay.LEFT);
|
copyButton.setContentDisplay(ContentDisplay.LEFT);
|
||||||
copyButton.setGraphicTextGap(8);
|
copyButton.setGraphicTextGap(8);
|
||||||
copyButton.setOnAction(e -> Utilities.copyToClipboard(offerChallenge));
|
copyButton.setOnMouseClicked(e -> {
|
||||||
|
Utilities.copyToClipboard(offerChallenge);
|
||||||
|
Tooltip tp = new Tooltip(Res.get("shared.copiedToClipboard"));
|
||||||
|
Node node = (Node) e.getSource();
|
||||||
|
UserThread.runAfter(() -> tp.hide(), 1);
|
||||||
|
tp.show(node, e.getScreenX() + Layout.PADDING, e.getScreenY() + Layout.PADDING);
|
||||||
|
});
|
||||||
copyButton.setId("buy-button");
|
copyButton.setId("buy-button");
|
||||||
copyButton.setFocusTraversable(false);
|
copyButton.setFocusTraversable(false);
|
||||||
vbox.getChildren().addAll(centerLabel, copyButton);
|
vbox.getChildren().addAll(centerLabel, copyButton);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue