***************************************************************************
COMPLETE SOURCE CODE FOR : CreateLabelUsingJLabel.java
***************************************************************************
import javax.swing.JLabel;
import javax.swing.JFrame;
public class CreateLabelUsingJLabel
{
public static void main(String[]args)
{
//Create a label with text My First Label using JLabel
JLabel label=new JLabel("My First Label");
//Create a JFrame that we will use to place JLabel
JFrame frame=new JFrame("Create label using JLabel");
//Add created label into JFrame
frame.add(label);
//Set default close operation for JFrame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Set JFrame size to :
//WIDTH = 400 pixels
//HEIGHT = 100 pixels
frame.setSize(400,100);
//Make JFrame visible. So we can see it.
frame.setVisible(true);
}
}
***************************************************************************
JUST COMPILE AND EXECUTE IT
***************************************************************************