1label = new JLabel("A label");
2label.setFont(new Font("Serif", Font.PLAIN, 14));
1import java.awt.Font;
2import javax.swing.*;
3public class SwingDemo {
4 public static void main(String args[]) {
5 JFrame frame = new JFrame("Label Example");
6 JLabel label;
7 label = new JLabel("First Label");
8 label.setBounds(50, 50, 100, 30);
9 label.setFont(new Font("Verdana", Font.PLAIN, 18));
10 frame.add(label);
11 frame.setSize(300,300);
12 frame.setLayout(null);
13 frame.setVisible(true);
14 }
15}