import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.border.MatteBorder;
public class Main {
public static void main(String[] argv) {
ImageIcon icon = new ImageIcon("image.gif");
MatteBorder matteBorder = (MatteBorder)BorderFactory.createMatteBorder(-1, -1, -1, -1, icon);
JLabel component = new JLabel("label");
component.setBorder(matteBorder);
}
}
|