如何设置window的线边界和边缘之间的距离?
How to set the distance between line border and edge of window?
你知道怎么做panel.setBorder(BorderFactory.createTitledBorder(txt))
它会创建一个边框,如果这是您 window 中唯一的面板,将会有
space 之间的边框,和window 的边缘。
但是如果你这样做 panel2.setBorder(BorderFactory.createLineBorder(Color.lightGray, 1))
钻孔器将触及 window.
的边缘
问题
如何更改线框与 window
边缘之间的距离
如果不够清楚请评论
the borer is gonna be touching the edge of a window....How do you change the distance between a lineborder and the edge of a window
您可以使用 CompoundBorder 嵌套边框。例如,要在线条边框周围创建 'padding' 边框:
CompoundBorder cb = new CompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createLineBorder(Color.BLACK));
myComponent.setBorder(cb);
你知道怎么做panel.setBorder(BorderFactory.createTitledBorder(txt))
它会创建一个边框,如果这是您 window 中唯一的面板,将会有
space 之间的边框,和window 的边缘。
但是如果你这样做 panel2.setBorder(BorderFactory.createLineBorder(Color.lightGray, 1))
钻孔器将触及 window.
问题
如何更改线框与 window
边缘之间的距离如果不够清楚请评论
the borer is gonna be touching the edge of a window....How do you change the distance between a lineborder and the edge of a window
您可以使用 CompoundBorder 嵌套边框。例如,要在线条边框周围创建 'padding' 边框:
CompoundBorder cb = new CompoundBorder(BorderFactory.createEmptyBorder(5,5,5,5), BorderFactory.createLineBorder(Color.BLACK));
myComponent.setBorder(cb);