JAVA programming Password Keeper Create a JavaFX program that helps the user kee
ID: 3810245 • Letter: J
Question
JAVA programming
Password Keeper
Create a JavaFX program that helps the user keep track of their passwords.
There must be a screen to login - with a username and a password
If the user doesn’t have a username and password, there must be a screen to create a
new one
Passwords must be between 8 and 10 alphanumeric characters, have at least 1 capital
letter, 1 number, and one special character NOT a space
Usernames must be checked against existing usernames - if a username that already
exists is chosen on registration, you must give an appropriate error message and allow
the user to pick a new user name
Once logged in, the user has three options:
Add a new site, login, and password, and notes
List all logins, passwords, and notes
Search for a login based on a site
This project should have:
An Abstract Password class with a print mechanism for passwords and an interface for
validating passwords
A simple password class that allows for unvalidated passwords
A complex password class that has a validation method that throws an exception
A Site class that includes website, username, password, and notes
The Site class should validate the website URL and throw an exception if invalid
A method to save usernames and passwords for the Password Keeper, and a method to
save Site class data (all as text).
This project covers the following SLOs:
Objects & Classes
Arrays
Inheritance
Polymorphism
JavaFX
Exception Handling
Text I/O
Abstract classes
Interfaces
Explanation / Answer
a JavaFX program that helps the user keep track of their passwords.
=====================
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.control.PasswordField ;
import javafx.scene.control.Label;
import javafx.scene.layoutimport javafx.stage.Stage;
public class Login extends Application {
Button btnsayan,btnInloggin;
TextField txtUsername;
PasswordField Password;
Label lblUsername,lblPassword;
int index;
String[] user = new String[10];
String[] pas = new String[10];
public static void main(String[] args) {
launch(args);
}
public void start(Stage primaryStage) {
primaryStage.setTitle("Aanmelden");
btnsayan = new Button();
btnsayan.setText("Aanmaken");
btnInloggin = new Button();
btnInloggin.setText("Inlogged in");
txtUsername=new TextField();
txtUsername.setMaxWidth(200);
Password=new PasswordField();
Password.setMaxWidth(200);
lblUsername=new Label();
lblUsername.setText("chayan");
lblPassword=new Label();
lblPassword.setText("Passwoord");
btnsayan.setOnAction(e ->{
if (index < 10){
index++;
user[index]=txtUsername.getText();
pas[index]=Password.getText();
AlertBox.display("Accountdetails","Account: Gebruikersnaam: " + user[index] + " Paswoord: " + pas[index] );
txtUsername.clear();
Password.clear();
}else{
AlertBox.display("Error", "U maximum accounts .");
}
});
btnInloggen.setOnAction(e ->{
for (int c = 0; c < 10; c++)
{
if ((user[c] == txtUsername.getText()) && (pas[c] == Password.getText())){
AlertBox.display("OKay", "good.");
}
else{
AlertBox.display("Error", "NIce OK.");
}
}
});
VBox layout = new VBox();
layout.getChildren().addAll(lblUsername,txtUsername,lblPassword,Password,btnsayan,btnInloggin);
Scene scene = new Scene(layout, 300, 250);
primaryStage.setScene(scene);
primaryStage.show();
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.