-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntroductionController.java
More file actions
127 lines (110 loc) · 3.71 KB
/
IntroductionController.java
File metadata and controls
127 lines (110 loc) · 3.71 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
118
119
120
121
122
123
124
125
126
127
package controller;
import CBTdata.SQLEngine;
import Main.Signin;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXComboBox;
import com.jfoenix.controls.JFXTextField;
import com.jfoenix.validation.RequiredFieldValidator;
import javafx.animation.RotateTransition;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.util.Duration;
import java.net.URL;
import java.util.ResourceBundle;
public class IntroductionController implements Initializable
{
@FXML
private AnchorPane anchorPane;
@FXML
public JFXTextField firstname;
@FXML
public JFXTextField lastname;
@FXML
private ImageView setting;
@FXML
private JFXComboBox<String> classcombo;
ObservableList<String> list = FXCollections.observableArrayList();
@FXML
private JFXButton startbtn;
public static String fn;
public static String ln;
SQLEngine sql;
Signin su;
Stage stage,stage2;
public void Main( Signin su,Stage stage)
{
this.stage = stage;
this.su = su;
}
public RequiredFieldValidator validator(String msg)
{
RequiredFieldValidator validator = new RequiredFieldValidator();
validator.setOpacity(0.5);
validator.setMessage(msg);
return validator;
}
@FXML
void start(ActionEvent event)
{
if(firstname.getText().isEmpty() || lastname.getText().isEmpty() || classcombo.getSelectionModel().isSelected(0))
{
firstname.validate();
lastname.validate();
}
else
{
su.introWindowClose();
questionWindow();
}
}
@Override
public void initialize(URL location, ResourceBundle resources)
{
firstname.getValidators().add(validator("Surname is required"));
lastname.getValidators().add(validator("Othernames is required"));
list.addAll("Class","JSS1","JSS2","JSS3","SS1","SS2","SS3");
classcombo.setItems(list);
fn = firstname.getText().toString();
ln = lastname.getText().toString();
setting.setOnMouseEntered(e ->{
RotateTransition rotateTransition=new RotateTransition(Duration.seconds(2), setting);
rotateTransition.setFromAngle(0);
rotateTransition.setToAngle(360);
rotateTransition.play();
});
setting.setOnMouseClicked(e ->{
su.settingWindow();
su.introWindowClose();
});
//stage.getIcons().add(new Image(getClass().getResourceAsStream("/Image/green computer.ico")));
}
public void questionWindow()
{
try
{
FXMLLoader loader = new FXMLLoader(Signin.class.getResource("/view/question.fxml"));
AnchorPane pane = loader.load();
QuestionController controller = loader.getController();
controller.details(firstname.getText().toUpperCase(),lastname.getText());
stage2 = new Stage();
Scene scene = new Scene(pane);
stage2.initStyle(StageStyle.UNDECORATED);
//stage2.getIcons().add(new Image(getClass().getResourceAsStream("/Images/green computer.ico")));
stage2.setScene(scene);
stage2.show();
}
catch(Exception e)
{
}
}
}