package io.bisq.gui.components;

import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AddressWithIconAndDirection extends AnchorPane {
    private static final Logger log = LoggerFactory.getLogger(AddressWithIconAndDirection.class);
    private final Hyperlink hyperlink;
    private final Label openLinkIcon;

    public AddressWithIconAndDirection(String text, String address, AwesomeIcon awesomeIcon, boolean received) {
        Label directionIcon = new AutoTooltipLabel();
        directionIcon.setLayoutY(3);
        directionIcon.getStyleClass().add("icon");
        directionIcon.getStyleClass().add(received ? "received-funds-icon" : "sent-funds-icon");
        AwesomeDude.setIcon(directionIcon, received ? AwesomeIcon.SIGNIN : AwesomeIcon.SIGNOUT);
        directionIcon.setMouseTransparent(true);

        HBox hBox = new HBox();
        hBox.setSpacing(-1);
        Label label = new AutoTooltipLabel(text);
        label.setMouseTransparent(true);
        HBox.setMargin(label, new Insets(4, 0, 0, 0));
        HBox.setHgrow(label, Priority.ALWAYS);

        hyperlink = new Hyperlink(address);
        HBox.setMargin(hyperlink, new Insets(1, 0, 0, 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);

        hBox.getChildren().addAll(label, hyperlink);

        openLinkIcon = new AutoTooltipLabel();
        openLinkIcon.setLayoutY(3);
        openLinkIcon.getStyleClass().addAll("icon", "highlight");
        openLinkIcon.setOpacity(0.7);
        AwesomeDude.setIcon(openLinkIcon, awesomeIcon);

        AnchorPane.setLeftAnchor(directionIcon, 3.0);
        AnchorPane.setTopAnchor(directionIcon, 2.0);
        AnchorPane.setLeftAnchor(hBox, 22.0);
        AnchorPane.setRightAnchor(hBox, 15.0);
        AnchorPane.setRightAnchor(openLinkIcon, 4.0);
        AnchorPane.setTopAnchor(openLinkIcon, 3.0);

        getChildren().addAll(directionIcon, hBox, openLinkIcon);
    }

    public void setOnAction(EventHandler<ActionEvent> handler) {
        hyperlink.setOnAction(handler);
        openLinkIcon.setOnMouseClicked(e -> handler.handle(null));
    }

    public void setTooltip(Tooltip tooltip) {
        hyperlink.setTooltip(tooltip);
        openLinkIcon.setTooltip(tooltip);
    }
}

@@ -692,46 +692,8 @@
 ink;
-%0A    private final Label openLinkIcon;
 %0A%0A  
@@ -1382,17 +1382,17 @@
  Insets(
-4
+8
 , 0, 0, 
@@ -1481,16 +1481,37 @@
 link
-(address
+WithIcon(address, awesomeIcon
 );%0A 
@@ -1554,17 +1554,17 @@
  Insets(
-1
+0
 , 0, 0, 
@@ -1923,252 +1923,8 @@
 );%0A%0A
-        openLinkIcon = new AutoTooltipLabel();%0A        openLinkIcon.setLayoutY(3);%0A        openLinkIcon.getStyleClass().addAll(%22icon%22, %22highlight%22);%0A        openLinkIcon.setOpacity(0.7);%0A        AwesomeDude.setIcon(openLinkIcon, awesomeIcon);%0A%0A
     
@@ -2020,17 +2020,17 @@
 onIcon, 
-2
+6
 .0);%0A   
@@ -2123,115 +2123,8 @@
 0);%0A
-        AnchorPane.setRightAnchor(openLinkIcon, 4.0);%0A        AnchorPane.setTopAnchor(openLinkIcon, 3.0);%0A%0A
     
@@ -2171,22 +2171,8 @@
 hBox
-, openLinkIcon
 );%0A 
@@ -2286,75 +2286,8 @@
 r);%0A
-        openLinkIcon.setOnMouseClicked(e -%3E handler.handle(null));%0A
     
@@ -2378,50 +2378,8 @@
 p);%0A
-        openLinkIcon.setTooltip(tooltip);%0A
     

Use HyperlinkWithIcon