How to create a rounded title border in Java Swing

后端 未结 2 1197
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-06 05:16

I do understand that to create a title border, you do something like:

BorderFactory.createTitledBorder(\"  Your Title  \");

However this cr

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-06 05:56

    It is possible to create a title border with rounded edges without implementing your own Border class. Simply pass a rounded border to TitledBorder's constructor. Try the following:

    LineBorder roundedLineBorder = new LineBorder(Color.black, 5, true);
    TitledBorder roundedTitledBorder = new TitledBorder(roundedLineBorder, "Title");
    

提交回复
热议问题