Bold titledBorder

后端 未结 4 680
既然无缘
既然无缘 2021-01-19 06:28

I tried doing

UIManager.getDefaults().put(\"TitledBorder.font\", Font.BOLD);
contentPanel.setBorder(new TitledBorder(\"Client Downloader\"));
4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-19 06:50

    You mark the question as accepted, but the comment says its not working. I would agree it should not be working.

    Font.BOLD
    

    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) );
    

    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.

提交回复
热议问题