JTextFied and JPasswordField
Steps:
import javax.swing.*;
public class frame extends JFrame {
JPanel p1;
JTextField tf;
JPasswordField pass;
public frame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
p1 = new JPanel();
p1.setLayout(null);
JLabel lblNewLabel = new JLabel("Username");
lblNewLabel.setBounds(35, 82, 71, 42);
p1.add(lblNewLabel);
tf = new JTextField();
tf.setBounds(116, 93, 126, 20);
p1.add(tf);
JLabel lblNewLabel_1 = new JLabel("Password");
lblNewLabel_1.setBounds(35, 135, 57, 14);
p1.add(lblNewLabel_1);
pass = new JPasswordField();
pass.setBounds(116, 132, 126, 20);
p1.add(pass);
JButton btn = new JButton("Submit");
btn.setBounds(113, 176, 89, 23);
p1.add(btn);
}
public static void main(String[] args) {
frame f1= new frame();
}
}
0 Comments