To reproduce run following code
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Hyperlink;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
public class HyperlinkBackground extends Application {
public static void main(String[] args) {
launch( args);
}
private Parent getContent() {
VBox list = new VBox(10);
Hyperlink link = new Hyperlink("Hyperlink\n\n long\n\n long line");
link.setGraphic(new Rectangle(30,30, Color.BLUE));
link.setStyle("-fx-background-color: "
+ "green;"
+ "-fx-background-insets: 10;"+"-fx-border-color: black;");
link.setPrefSize(200, 200);
link.setFocusTraversable(false);
list.getChildren().add(link);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(300);
stage.setHeight(300);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.setVisible(true);
}
}
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Hyperlink;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
public class HyperlinkBackground extends Application {
public static void main(String[] args) {
launch( args);
}
private Parent getContent() {
VBox list = new VBox(10);
Hyperlink link = new Hyperlink("Hyperlink\n\n long\n\n long line");
link.setGraphic(new Rectangle(30,30, Color.BLUE));
link.setStyle("-fx-background-color: "
+ "green;"
+ "-fx-background-insets: 10;"+"-fx-border-color: black;");
link.setPrefSize(200, 200);
link.setFocusTraversable(false);
list.getChildren().add(link);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(300);
stage.setHeight(300);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.setVisible(true);
}
}