Urgent i need your help! I want you to set the username = admin and password =123456 and then when i log in there another frame will pop up and say "Successfully Login!" Ps.Use Java Programming.10q import java.awt.GridLayout; import java.awt.*; import javax.swing.*; public class Trial { public static void main(String[] args) { JFrame frm = new JFrame ("PASSWORD ENTER"); JLabel lb1Name = new JLabel("USERNAME: "); JPasswordField value = new JPasswordField(); JLabel lb2Pass = new JLabel ("PASSWORD: "); JTextField txtName = new JTextField(20); lb1Name.setFont(new Font("consolas",Font.BOLD,20)); txtName.setFont(new Font("consolas",Font.PLAIN,20)); txtName.setHorizontalAlignment(JTextField.CENTER); lb2Pass.setFont(new Font("consolas",Font.PLAIN,20)); lb1Name.setBounds(50,100,80,30); lb2Pass.setBounds(50,150,80,30); frm.setLayout(new GridLayout(1,2,5,5)); frm.add(lb1Name); frm.add(txtName); frm.setSize(500,100); frm.setVisible(true); frm.add(lb2Pass); frm.add(value); frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frm.setLocationRelativeTo(null); }
Urgent i need your help! I want you to set the username = admin and password =123456 and then when i log in there another frame will pop up and say "Successfully Login!"
Ps.Use Java
import java.awt.GridLayout;
import java.awt.*;
import javax.swing.*;
public class Trial {
public static void main(String[] args) {
JFrame frm = new JFrame ("PASSWORD ENTER");
JLabel lb1Name = new JLabel("USERNAME: ");
JPasswordField value = new JPasswordField();
JLabel lb2Pass = new JLabel ("PASSWORD: ");
JTextField txtName = new JTextField(20);
lb1Name.setFont(new Font("consolas",Font.BOLD,20));
txtName.setFont(new Font("consolas",Font.PLAIN,20));
txtName.setHorizontalAlignment(JTextField.CENTER);
lb2Pass.setFont(new Font("consolas",Font.PLAIN,20));
lb1Name.setBounds(50,100,80,30);
lb2Pass.setBounds(50,150,80,30);
frm.setLayout(new GridLayout(1,2,5,5));
frm.add(lb1Name);
frm.add(txtName);
frm.setSize(500,100);
frm.setVisible(true);
frm.add(lb2Pass);
frm.add(value);
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frm.setLocationRelativeTo(null);
}
Step by step
Solved in 4 steps with 4 images