Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add superscript to Label text in Javafx 8

I am writing my first JavaFX application and I cannot find how to make some of the text in a Label to be superscript.

In Swing it was easy enough to use HTML tags, but this option is not available in JavaFX.

I have searched through many of the api's including Label, Font, TextFlow, Oracle docs and samples, and the internet in general.

Thank you.

like image 864
TonyJ Avatar asked Sep 15 '25 11:09

TonyJ


1 Answers

The WebView is more flexible, but, depending upon which font you are using and the content of the superscript, there are Unicode superscript characters such as U+00B2 for the superscript 2.

like image 80
clartaq Avatar answered Sep 17 '25 01:09

clartaq