Password Evaluator Complete the following programming problem. Implement the sol
ID: 3534225 • Letter: P
Question
Password Evaluator
Complete the following programming problem. Implement the solution as a Java GUI application based on a framed window that resembles the following:
Imagine you are developing a software package for Amazon.com that requires users to enter their own passwords. Your software requires that user passwords meet the following criteria:
Write an application that verifies that a password meets the stated criteria.
Messages should be displayed on the form with the following text when failure to meet the criteria occurs:
Explanation / Answer
You can increase your creativity with this source. And you can add a new Label or Button to make a best program. I'll give you a source code. You must save this code with name"Log.java".
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Log extends JFrame {
public static void main(String[] args) {
Log frameTabel = new Log();
}
JButton blogin = new JButton("Login");
JPanel panel = new JPanel();
JTextField txuser = new JTextField(15);
JPasswordField pass = new JPasswordField(15);
Log(){
super("Login Autentification");
setSize(300,200);
setLocation(500,280);
panel.setLayout (null);
txuser.setBounds(70,30,150,20);
pass.setBounds(70,65,150,20);
blogin.setBounds(110,100,80,20);
panel.add(blogin);
panel.add(txuser);
panel.add(pass);
getContentPane().add(panel);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
actionlogin();
}
public void actionlogin(){
blogin.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
String puname = txuser.getText();
String ppaswd = pass.getText();
if(puname.equals("test") && ppaswd.equals("12345")) {
newframe regFace =new newframe();
regFace.setVisible(true);
dispose();
} else {
JOptionPane.showMessageDialog(null,"Wrong Password / Username");
txuser.setText("");
pass.setText("");
txuser.requestFocus();
}
}
});
}
}
and you must save this source below with name "newframe.java"
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class newframe extends JFrame {
public static void main(String[] args) {
newframe frameTabel = new newframe();
}
JLabel welcome = new JLabel("Welcome to a New Frame");
JPanel panel = new JPanel();
newframe(){
super("Welcome");
setSize(300,200);
setLocation(500,280);
panel.setLayout (null);
welcome.setBounds(70,50,150,60);
panel.add(welcome);
getContentPane().add(panel);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
}