swing插入背景图中间出现空白

swing插入背景图片时,出现中间还有空白的情况,怎么搞

img

这是工具类:
public void setBak(){
((JPanel)this.getContentPane()).setOpaque(false);
this.setLayout(new FlowLayout());
ImageIcon img = new ImageIcon("pic//3.jpg");
JLabel background = new JLabel(img);
this.getLayeredPane().add(background, new Integer(Integer.MIN_VALUE));
background.setBounds(0, 0, img.getIconWidth(), img.getIconHeight());
}

这是main界面调用图片情况
setBak();
Container c = getContentPane();
JPanel j = new JPanel();
j.setOpaque(false);
c.setLayout(null);
c.add(j,new Integer(Integer.MIN_VALUE));

这是此子界面相关代码:
public AddCourse(){
cname=new JTextField(12);
credit=new JTextField(12);
cterm=new JTextField(12);
ctea=new JTextField(12);

    addcou=new JButton("录入课程");
    addcou.addActionListener(this);
    
    Box box1=Box.createHorizontalBox();
    Box box2=Box.createHorizontalBox();
    Box box3=Box.createHorizontalBox();
    Box box4=Box.createHorizontalBox();
    Box box5=Box.createHorizontalBox();
    
    box1.add(new JLabel("课名:"));
    box1.add(cname);
    box2.add(new JLabel("学分:"));
    box2.add(credit);
    box3.add(new JLabel("学期:"));
    box3.add(cterm);
    box4.add(new JLabel("教师:"));
    box4.add(ctea);
    
    box5.add(addcou);
    Box boxH=Box.createHorizontalBox();
    boxH.add(box1);
    boxH.add(box2);
    boxH.add(box3);
    boxH.add(box4);
    boxH.add(box5);
    
    boxH.add(Box.createVerticalGlue());
    JPanel messPanel=new JPanel();
    messPanel.add(boxH);
    setLayout(new BorderLayout());
    add(messPanel,BorderLayout.CENTER);
    validate();
}