Java Swing Program to demonstrate JTextField with Text

Program

import javax.swing.*;
public class JTextFieldTextDemo
{
	public static void main(String args[])
	{
		JFrame frm = new JFrame("JTextField Demo");
		JTextField txtUserName, txtPassword;
		txtUserName = new JTextField("Enter Username");
		txtUserName.setBounds(0, 0, 120, 20);
		txtPassword = new JTextField("Enter Password");
		txtPassword.setBounds(0, 20, 120, 20);
		frm.add(txtUserName);
		frm.add(txtPassword);
		frm.setSize(300, 300);
		frm.setLayout(null);
		frm.setVisible(true);
		frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
}

Output

Swing JTextField with text