简体   繁体   中英

Adding a JPanel to another JPanel adds padding

当我将一个JPanel添加到另一个JPanel时,似乎存在默认的填充/边距,如何删除它?

The padding depends on the layout managers you are using for each of the panels.

For example the default layout manager for a JPanel is a FlowLayout with padding of 5 pixels.

If you don't like the 5 pixels, then change the padding of the FlowLayout. Read the FlowLayout API (or whatever layout manager you are using) for the appropriate method to change.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM