JLabel Horizontal Text Position - Java Swing

Java examples for Swing:JLabel

Description

JLabel Horizontal Text Position

Demo Code


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);
        }
}

Related Tutorials