Java Swing Program to demonstrate Jlabel
Program
import javax.swing.*;
public class JLabelDemo
{
public static void main(String args[])
{
JFrame frm = new JFrame("JLabel Demo");
JLabel lblUserName, lblPassword;
lblUserName = new JLabel("User Name:");
lblUserName.setBounds(0, 0, 100, 50);
lblPassword = new JLabel("Password:");
lblPassword.setBounds(0, 50, 100, 50);
frm.add(lblUserName);
frm.add(lblPassword);
frm.setSize(300, 300);
frm.setLayout(null);
frm.setVisible(true);
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
Output