Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TitledBorder border color and width using UIManager

To change all TitledBorder fonts, I am using UIManager:

UIManager.put("TitledBorder.font", new Font("Tahoma", Font.BOLD, 11));

But what to put to TitledBorder.border property to change only the color of the border (or maybe even it's width)?

Cheers

like image 458
radzi0_0 Avatar asked Dec 16 '22 19:12

radzi0_0


1 Answers

Just as using UIManager to change all TitledBorder font at once, to change TitledBorder borders use this function:

UIManager.put("TitledBorder.border", new LineBorder(new Color(200,200,200), 1));

It will change (set) the border property to the border object passed in a second parameter. All border types (even the factory class) description can be found here: http://docs.oracle.com/javase/tutorial/uiswing/components/border.html

This sample passes LineBorder object which takes color and width in a constructor just as you asked.

like image 95
radzi0_0 Avatar answered Jan 08 '23 14:01

radzi0_0