-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPasswordGenerator.java
More file actions
72 lines (63 loc) · 2.19 KB
/
Copy pathPasswordGenerator.java
File metadata and controls
72 lines (63 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package com.example.newproject4;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.scene.layout.VBox;
public class PasswordGenerator extends Application {
Stage window;
Button button;
Button encryptButton;
Scene scene;
Label passLength;
Label passwordText;
public static void main(String[] args){
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
//create window
window = stage;
window.setTitle("Project4");
//labels
passLength = new Label("Password Length:");
passwordText = new Label("Password:");
//create textfield and button
TextField Length = new TextField();
TextField output = new TextField();
button = new Button("Generate");
encryptButton = new Button("Encrypt Password");
//what happens when button is pressed
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
Generator generator = new Generator(Length.getText());
generator.Generate();
output.setText(generator.getPassword());
}
});
encryptButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
Security security = new Security(output.getText());
output.setText(security.Encryption());
}
});
//how the layout looks
VBox layout = new VBox(10);
layout.setPadding(new Insets(20, 20, 20, 20));
layout.getChildren().addAll(passLength, Length, passwordText, output, button, encryptButton);
//creating the scene
scene = new Scene(layout, 300, 250);
window.setScene(scene);
window.show();
}
}