Java JLabel set HTML as text
import javax.swing.JFrame; import javax.swing.JLabel; public class Main extends JFrame { public Main() { super("Link JLabel with JTextField"); setDefaultCloseOperation(EXIT_ON_CLOSE); JLabel nameLabel = new JLabel("Name:"); nameLabel.setText("<html><i>My Demo</i></html>"); add(nameLabel);//from w ww. j a v a2 s . co m } public static void main(String[] args) { Main frame = new Main(); frame.pack(); frame.setVisible(true); } }