[求助]为什么上下两行Button之间有间隙
为什么上下两行Button之间有间隙import java.awt.*;
import javax.swing.*;
public class ButtonLayout extends JFrame
{
public ButtonLayout()
{
Container container=getContentPane();
container.setLayout(new BorderLayout());
JPanel p1=new JPanel();
for(int i=1;i<=3;i++)
p1.add(new JButton("Button"+i));
JPanel p2=new JPanel();
for(int i=4;i<=6;i++)
p2.add(new JButton("Button"+i));
container.add(p1,BorderLayout.CENTER);
container.add(p2,BorderLayout.SOUTH);
}
public static void main(String[] args)
{
ButtonLayout frame=new ButtonLayout();
frame.setTitle("ButtonLayout");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400,300);
frame.setVisible(true);
}
}
----------------解决方案--------------------------------------------------------