开发者

JPanel and TitledBorder UI properties with Nimbus

开发者 https://www.devze.com 2023-02-19 03:07 出处:网络
I would like to change the default Nimbus TitledBorder L&F, to a simple blue rounded titled border.The title should also be blue.

I would like to change the default Nimbus TitledBorder L&F, to a simple blue rounded titled border. The title should also be blue. I could make it, but the problem is that i would like to apply it to specific panel and not all panels in my GUI, so UIManager.put("TitledBorder.titleColor", Color.blue) is not applicable. I could do it other way than with the L&F properties, but using L&F properties is less change in code if i have to change something. How can i set to开发者_Python百科 only the wanted panel using L&F properties ? Thank you for help.


Can you try the below code?

jPanel.setBorder(new TitledBorder(new LineBorder(Color.BLUE), "Sample title", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.CENTER, new Font("SansSerif", Font.PLAIN, 12), Color.BLUE))
0

精彩评论

暂无评论...
验证码 换一张
取 消