-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathController.java
More file actions
117 lines (94 loc) · 3.83 KB
/
Controller.java
File metadata and controls
117 lines (94 loc) · 3.83 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import java.io.IOException;
import java.lang.reflect.Field;
import javax.print.attribute.standard.Fidelity;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.scene.control.*;
import javafx.event.ActionEvent;
import javafx.scene.*;
import java.util.ArrayList;
public class Controller {
//instances
private Stage stage;
@FXML
private TextField webmailLoginField;
@FXML
private PasswordField webmailPasswordField;
@FXML
private Label wrongInfoLabel;
//stack of previous scenes
public static ArrayList<Scene> backscenes = new ArrayList<>();
//stack of scenes going forward
public static ArrayList<Scene> frontscenes = new ArrayList<>();
@FXML
public void goToPassword(){
webmailPasswordField.requestFocus();
}
public void goBack(ActionEvent e) throws IOException{
stage = (Stage)((Node)e.getSource()).getScene().getWindow();
if(backscenes.size() - 1 > 0){
stage.setScene(backscenes.get(backscenes.size()-2));
frontscenes.add(backscenes.get(backscenes.size()-1));
backscenes.remove(backscenes.size()-1);
}
}
public void goFront(ActionEvent e) throws IOException{
stage = (Stage)((Node)e.getSource()).getScene().getWindow();
if(backscenes.size() - 1 > 0){
stage.setScene(frontscenes.get(frontscenes.size()-1));
frontscenes.remove(frontscenes.size()-1);
}
}
public void switchToLogin(ActionEvent e) throws IOException{
Parent loginRoot = FXMLLoader.load(getClass().getResource("loginscenebuilder.fxml"));
//stage i getiriyoruz
stage = (Stage)((Node)e.getSource()).getScene().getWindow();
Scene loginScene = new Scene(loginRoot);
stage.setScene(loginScene);
backscenes.add(loginScene);
stage.show();
}
public void switchToNamePage(ActionEvent e) throws IOException{
Parent nameRoot = FXMLLoader.load(getClass().getResource("namePage.fxml"));
//stage i getiriyoruz
stage = (Stage)((Node)e.getSource()).getScene().getWindow();
Scene signUpScene = new Scene(nameRoot);
stage.setScene(signUpScene);
backscenes.add(signUpScene);
stage.show();
}
public void switchToSignUp(ActionEvent e) throws IOException{
Parent signUpRoot = FXMLLoader.load(getClass().getResource("signupscenebuilder.fxml"));
//stage i getiriyoruz
stage = (Stage)((Node)e.getSource()).getScene().getWindow();
Scene signUpScene = new Scene(signUpRoot);
stage.setScene(signUpScene);
backscenes.add(signUpScene);
stage.show();
}
public void switchToInterest(ActionEvent e) throws IOException{
Parent interestRoot = FXMLLoader.load(getClass().getResource("interestpage2.fxml"));
//stage i getiriyoruz
stage = (Stage)((Node)e.getSource()).getScene().getWindow();
Scene signUpScene = new Scene(interestRoot);
stage.setScene(signUpScene);
backscenes.add(signUpScene);
stage.show();
}
public void getMailText(ActionEvent e) throws IOException{
String mail = webmailLoginField.getText();
String password = webmailPasswordField.getText();
boolean accurate = LoginVerifier.verify(mail, password);
if(accurate){
Parent mainPage = FXMLLoader.load(getClass().getResource("defaultpage.fxml"));
Scene mainScene = new Scene(mainPage);
stage = (Stage)((Node)e.getSource()).getScene().getWindow();
stage.setScene(mainScene);
backscenes.add(mainScene);
}
else{
wrongInfoLabel.setVisible(true);
}
}
}