如何在Javafx 8中向Label文本添加上标 [英] How to add superscript to Label text in Javafx 8
问题描述
我正在编写我的第一个JavaFX应用程序而且我找不到如何使Label中的某些文本成为上标。
I am writing my first JavaFX application and I cannot find how to make some of the text in a Label to be superscript.
在Swing中它很容易使用HTML标签,但这个选项在JavaFX中不可用。
In Swing it was easy enough to use HTML tags, but this option is not available in JavaFX.
我搜索了很多api,包括Label,Font,TextFlow,Oracle docs和samples,以及一般的互联网。
I have searched through many of the api's including Label, Font, TextFlow, Oracle docs and samples, and the internet in general.
谢谢。
推荐答案
WebView
更灵活,但是,根据您使用的字体和上标的内容,有 Unicode上标字符,例如 U + 00B2
的上标2。
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.
这篇关于如何在Javafx 8中向Label文本添加上标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!