大胆的标题为博德 [英] Bold titledBorder
本文介绍了大胆的标题为博德的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试过了
UIManager.getDefaults().put("TitledBorder.font", Font.BOLD);
contentPanel.setBorder(new TitledBorder("Client Downloader"));
但它并没有大胆。它只是间隔开来。
But it's not making it bold. It just looked spaced apart.
这是错误的方式吗?
推荐答案
您将问题标记为已接受,但评论说它不起作用。我同意它不应该工作。
You mark the question as accepted, but the comment says its not working. I would agree it should not be working.
Font.BOLD
不是字体。它是Font的属性。如果你想改变你可以做的字体:
is not a Font. It is a property of a Font. If you want to change the font you can do:
TitledBorder border = new TitledBorder(...);
border.setTitleFont( border.getTitleFont().deriveFont(Font.BOLD + Font.ITALIC) );
我添加斜体只是为了向您展示代码的工作原理,因为在我看来,在Metal中LAF默认为粗体字。
I added the italic just to show you the code works, since it appears to me that in the Metal LAF the default is for a Bold font.
这篇关于大胆的标题为博德的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文