To insert padding into a JLabel we should use an EmptyBorder, where the attribute ‘width’ will be our padding. Like this:

...
JLabel jLabel = new JLabel("My JLabel");
//Border used as padding
Border paddingBorder = BorderFactory.createEmptyBorder(10,10,10,10);

jLabel.setBorder(BorderFactory.createCompoundBorder(border,paddingBorder));
...

Here, the JLabel contains a padding with 10 pixels in top, right, bottom and left, respectively.

0

If you want to put border around the JLabel, you can use a CompoundBorder, setting Border and EmptyBorder (padding):

...
JLabel jLabel = new JLabel("Meu JLabel");
//Border used as padding
Border paddingBorder = BorderFactory.createEmptyBorder(10,10,10,10);
//JLabel will be involved for this border
Border border = BorderFactory.createLineBorder(Color.BLUE);

jLabel.setBorder(BorderFactory.createCompoundBorder(border,paddingBorder));
...

1

Download the source code of this sample here.