Question: How can I remove the default spacing on my JLabels? I'm using the following code to put an image on the JLabel.

```
JLabel image = new JLabel(new ImageIcon("myimage.png"));

```

When I add this image to a JPanel, there is a bit of whitespace around the image. How can I reset this padding to zero?

Answer: 
> 
> there is a bit of whitespace around the image
> 
> 
> 

What 'whitespace'?

![Label Padding Test](https://i.stack.imgur.com/RVmUp.png)

```
import java.awt.*;
import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.imageio.ImageIO;
import java.net.URL;

class LabelPaddingTest {
    public static void main(String[] args) throws Exception {
        URL url = new URL("http://pscode.org/media/citymorn2.jpg");
        final Image image = ImageIO.read(url);
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                JLabel l = new JLabel(new ImageIcon(image));
                l.setBorder(new LineBorder(Color.GREEN.darker(), 5));
                JOptionPane.showMessageDialog(null, l);
            }
        });
    }
}

```

As mKorbel notes, the problem is in some other area of the code. For better help sooner, post an [SSCCE](http://sscce.org/).
As per the given code,there will not be any white space unless `myimage.png` have a white space around it.Please check. If the problem still persists post an [sscce](http://sscce.org) along with your `myimage.png`