Friday, April 5, 2019

Example Of PassWordField Option In Swing

program:

import javax.swing.*;
public class PasswordFieldDemo
{
public static void main(String[] args)
{
JFrame jf=new JFrame("Password Field Demo");
JPasswordField val=new JPasswordField();
JLabel l1=new JLabel("PassWord");
l1.setBounds(50,110,90,40);
val.setBounds(110,110,110,40);
jf.add(val);
jf.add(l1);
jf.setSize(310,310);
jf.setVisible(true);
jf.setLayout(null);
}
}
output:
run the file as follows
javac PasswordFieldDemo.java
java PasswordFieldDemo

No comments:

Post a Comment