Java中的下划线字体的常量值是多少? [英] What is the Constant Value of the Underline font in Java?
问题描述
Java中下划线字体的常量值是什么?
What is the Constant Value of the Underline font in Java ?
Font.BOLD 粗体字体
Font.BOLD bold font
Font.ITALIC 斜体字体
Font.ITALIC italic font
UNDERLINE字体是什么?
我尝试所有可用的常量,但它不工作。
What is the UNDERLINE font Constant ? I try all the available constants but it didn't work .
推荐答案
查看 Java API规范,似乎 Font
class 没有常数
Looking at the Java API Specification, it appears that the Font
class does not have a constant for underlining.
但是,使用 Font(Map< ;? extends AttributedCharacterIterator.Attribute,?> attributes)
构造函数,可以给它一个 Map
,其中包含 TextAttribute
和要使用的值,以便指定字体属性。 (注意 TextAttribute
类是 AttributedCharacterIterator.Attribute
的子类)
However, using the Font(Map<? extends AttributedCharacterIterator.Attribute,?> attributes)
constructor, one can give it a Map
containing the TextAttribute
and the value to use, in order to specify the font attributes. (Note that the TextAttribute
class is a subclass of AttributedCharacterIterator.Attribute
)
TextAttribute.UNDERLINE
看起来像感兴趣的 TextAttribute
。
修改: TextAttribute 的示例/tutorial/2d/text/textattributes.htmlrel =nofollow noreferrer>使用文本属性到样式文本部分从 Java教程。
There's an example of using TextAttribute
in the Using Text Attributes to Style Text section from The Java Tutorials.
这篇关于Java中的下划线字体的常量值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!