Java中的JPanel填充 [英] JPanel Padding in Java
本文介绍了Java中的JPanel填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
在<$ c $的周围设置 EmptyBorder
c> JPanel 。
示例:
JPanel p = new JPanel );
p.setBorder(new EmptyBorder(10,10,10,10));
I have a formatting question for my Java swing application. It should be fairly straightforward, but I am having difficulty finding any aid (Every topic seems to be regarding removing any default padding in JPanel). The text in my various JPanels hug the sides and top, touching the colored borders: how can I add padding? Thank you.
解决方案
Set an EmptyBorder
around your JPanel
.
Example:
JPanel p =new JPanel();
p.setBorder(new EmptyBorder(10, 10, 10, 10));
这篇关于Java中的JPanel填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文