Java examples for Swing:JLabel
How to get gap between JLabel's icon and text
import javax.swing.ImageIcon; import javax.swing.JApplet; import javax.swing.JLabel; public class Main { //from w w w. ja v a2s . c o m public void init(){ ImageIcon icon = new ImageIcon("images/copy.gif"); JLabel copyLabel = new JLabel("Copy", icon, JLabel.CENTER); int gap = copyLabel.getIconTextGap(); copyLabel.setIconTextGap(50); } }