Java examples for Swing:JLabel
JLabel Horizontal Text Position
import javax.swing.ImageIcon; import javax.swing.JApplet; import javax.swing.JLabel; public class Main { public void init(){ ImageIcon icon = new ImageIcon("images/copy.gif"); /* ww w . jav a 2 s . co m*/ JLabel copyLabel = new JLabel("Copy", icon, JLabel.CENTER); int position = copyLabel.getHorizontalTextPosition(); copyLabel.setHorizontalTextPosition(JLabel.RIGHT); } }