Make a JPanel border with title like in Firefox

筅森魡賤 提交于 2019-12-01 15:31:17

问题


I would like to make an option dialog in my application. In this dialog I want to make kind of Areas surrounded with a border and with a title.

An example of what I want is in Firefox:

How can I do something like that in Java?


回答1:


Here you can find all informations you need.

Basically you can use border factory to create a Border using types available in Swing:

Border lineBorder = BorderFactory.createLineBorder(Color.black);
JPanel panel = new JPanel();
panel.setBorder(lineBorder);

You can also define your custom borders implementing Border interface.



来源:https://stackoverflow.com/questions/7500070/make-a-jpanel-border-with-title-like-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!