java – Bold titledBorder
•
Java
I tried
UIManager.getDefaults().put("TitledBorder.font",Font.BOLD); contentPanel.setBorder(new TitledBorder("Client Downloader"));
But it did not make it bold It just seems to separate
Is this the wrong way?
Solution
You marked the question as accepted, but commented that it didn't work I agree that it should not work
Font.BOLD
Not a font It is an attribute of font If you want to change the font, you can do the following:
TitledBorder border = new TitledBorder(...); border.setTitleFont( border.getTitleFont().deriveFont(Font.BOLD + Font.ITALIC) );
I added italics just to show you how the code works, because in my opinion, in metal LAF, the default font is bold
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码