To change text font, you can use the setFont() method of JLabel −
label.setFont(new Font("Verdana", Font.PLAIN, 12));The following is an example to change text font for JLabel with HTML −
Example
import java.awt.Font;
import javax.swing.*;
public class SwingDemo {
public static void main(String args[]) {
JFrame frame = new JFrame("Label Example");
JLabel label;
label = new JLabel("<html><font size=+1>" + "<center>ABC</html>");
label.setBounds(50, 50, 100, 30);
label.setFont(new Font("Verdana", Font.PLAIN, 12));
frame.add(label);
frame.setSize(500,300);
frame.setLayout(null);
frame.setVisible(true);
}
}Output
