关于#java#的问题:我想使用java 的 GridBagLayout 布局中插入图片但是至始至终都会有一部分白边如下图

java

事情是这样的,我想使用java 的 GridBagLayout 布局中插入图片
于是我截了141*126大小的图片,使用JLabel插入图片
但是至始至终都会有一部分白边
如下图(黑色部分为图片)

img

目的
使用图片代替以下的绿色部分(141*126),要求与其他部分没有缝隙
如图

img

我写的代码

import javax.swing.*;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Color;
import java.awt.GridBagConstraints;

public class Windows2 extends JFrame {
    private JPanel p_1, p_2, p_3, p_4, p_5, p_6, p_7, p_8, p_9;
    private JLabel l_image;
    
    public Windows2( String name , int h, int w )
    {
        this.setTitle(name);
        this.setLocationRelativeTo(null);
        this.setSize(w, h);
        init();
        this.setVisible(true);
    }

    public void init()
    {
        GridBagLayout gbl = new GridBagLayout();
        this.setLayout( gbl );
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.fill = GridBagConstraints.BOTH;

        ImageIcon image = new ImageIcon( this.getClass().getResource("title.png") );
        l_image = new JLabel( image );
        //p_1.setBackground( Color.BLUE );
        gbc.gridx=0;
        gbc.gridy=0;
        gbc.gridwidth=1;
        gbc.gridheight=1;
        gbc.weightx=0.5;
        gbc.weighty=0.5;
        //gbc.insets = new Insets( 5, 5 , 5 , 5);
        //this.add( p_1, gbc );
        gbl.setConstraints( l_image, gbc );

        p_1 = new JPanel();
        p_1.setBackground( Color.GREEN );
        gbc.gridx=0;
        gbc.gridy=0;
        gbc.gridwidth=1;
        gbc.gridheight=1;
        gbc.weightx=0.5;
        gbc.weighty=0.5;
        //gbc.insets = new Insets( 5, 5 , 5 , 5);
        //this.add( p_2, gbc );
        gbl.setConstraints( p_1, gbc );

        p_2 = new JPanel();
        p_2.setBackground( Color.ORANGE );
        gbc.gridx=1;
        gbc.gridy=0;
        gbc.gridwidth=1;
        gbc.gridheight=2;
        gbc.weightx=0.5;
        gbc.weighty=0.8;
        //gbc.insets = new Insets( 5, 5 , 5 , 5);
        //this.add( p_2, gbc );
        gbl.setConstraints( p_2, gbc );

        p_3 = new JPanel();
        p_3.setBackground( Color.RED );
        gbc.gridx=0;
        gbc.gridy=1;
        gbc.gridwidth=1;
        gbc.gridheight=1;
        gbc.weightx=0.5;
        gbc.weighty=0.5;
        //gbc.insets = new Insets( 5, 5 , 5 , 5);
        //this.add( p_3, gbc );
        gbl.setConstraints( p_3, gbc );
        

        this.add( l_image );
        //l_image.setBounds(0, 0, 126, 141);
        //this.add( p_1 );
        this.add( p_2 );
        this.add( p_3 );

    }
}





各位帮我找一找错误吧
谢谢各位了