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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With