#Customizing Hyperlink Appearance in JavaFX

1 messages ยท Page 1 of 1 (latest)

idle agateBOT
#

@nimble flame has a question:

dktlskxm

Hi, is there any way to change the height and bg color of hyperlink text in javafx?

#

<@&987246399047479336> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question ๐Ÿค–. Maybe it helps! In any case, a human is on the way ๐Ÿ‘. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
Hi, is there any way to change the height and bg color of hyperlink text in javafx?

Yes, you can customize the appearance of a Hyperlink in JavaFX by using CSS. You can change the height, background color, and other properties by defining a style class for the Hyperlink and applying CSS rules to it. Here is an example:

Hyperlink hyperlink = new Hyperlink("Click me!");
hyperlink.getStyleClass().add("custom-hyperlink");

And in your CSS file:

.custom-hyperlink {
    -fx-background-color: lightblue;
    -fx-pref-height: 30px;
}

Useful links:

#

Changed the category to JavaFX|Swing.

#

<@&987246487241105418> please have a look, thanks.

violet seal
#

For everything appearance customization in java FX, you can refer to the modena.css file from their source code

https://github.com/openjdk/jfx/blob/master/modules/javafx.controls/src/main/resources/com/sun/javafx/scene/control/skin/modena/modena.css

If you really want you can even wipe out the modena stylesheet
https://stackoverflow.com/a/62473249

GitHub

JavaFX mainline development. Contribute to openjdk/jfx development by creating an account on GitHub.