Set Font for JLabel - Java Swing

Java examples for Swing:JLabel

Description

Set Font for JLabel

Demo Code


import java.awt.Font;

import javax.swing.JLabel;

public class Main {
  public void m() {

    JLabel label1 = new JLabel("JLabel Font.");
    // create new Font
    Font font = new Font("Courier", Font.BOLD, 12);

    // set font for JLabel
    label1.setFont(font);/*from   ww w.ja  v a2 s .  co m*/

  }
}

Related Tutorials