Repository navigation
Expand file tree
/
Copy pathSampleController.java
More file actions
178 lines (143 loc) · 4.81 KB
/
Copy pathSampleController.java
File metadata and controls
178 lines (143 loc) · 4.81 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
package application;
import java.io.IOException;
import java.util.Calendar;
import java.util.TimeZone;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Modality;
import javafx.stage.Stage;
public class SampleController{
@FXML
private Button btn1;
@FXML
private Button btn2;
@FXML
public void home2habits() throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Sample3.fxml"));
Stage window = (Stage) btn2.getScene().getWindow();
window.setScene(new Scene(root, 850, 550));
}
@FXML
public void home2statistics() throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Sample2.fxml"));
Stage window = (Stage) btn1.getScene().getWindow();
window.setScene(new Scene(root, 850, 550));
}
@FXML
private Button btn3;
@FXML
private Button btn4;
@FXML
public void statistics2habits() throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Sample3.fxml"));
Stage window = (Stage) btn4.getScene().getWindow();
window.setScene(new Scene(root, 850, 550));
}
@FXML
public void statistics2home() throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml"));
Stage window = (Stage) btn3.getScene().getWindow();
window.setScene(new Scene(root, 850, 550));
}
@FXML
private Button btn5;
@FXML
private Button btn6;
@FXML
public void habits2home() throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml"));
Stage window = (Stage) btn5.getScene().getWindow();
window.setScene(new Scene(root, 850, 550));
}
@FXML
public void habits2statistics() throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("Sample2.fxml"));
Stage window = (Stage) btn6.getScene().getWindow();
window.setScene(new Scene(root, 850, 550));
}
@FXML
private Button addy;
@FXML
void addHabit(ActionEvent event) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("add.fxml"));
Parent root = (Parent) fxmlLoader.load();
Stage stage = new Stage();
stage.setScene(new Scene(root));
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(addy.getScene().getWindow());
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
@FXML
private Button edity;
@FXML
void editHabit(ActionEvent event) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("edit.fxml"));
Parent root = (Parent) fxmlLoader.load();
Stage stage = new Stage();
stage.setScene(new Scene(root));
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(edity.getScene().getWindow());
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
@FXML
private Button deletey;
@FXML
void deleteHabit(ActionEvent event) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("delete.fxml"));
Parent root = (Parent) fxmlLoader.load();
Stage stage = new Stage();
stage.setScene(new Scene(root));
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(deletey.getScene().getWindow());
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
@FXML
private Button viewy;
@FXML
void viewHabit(ActionEvent event) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("view.fxml"));
Parent root = (Parent) fxmlLoader.load();
Stage stage = new Stage();
stage.setScene(new Scene(root));
root.getStylesheets().add(getClass().getResource("style.css").toExternalForm());
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(deletey.getScene().getWindow());
stage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
@FXML private Label donelbl;
@FXML private Label missedlbl;
@FXML private Label totallbl;
@FXML private Button GetDatabtn;
@FXML
public void displayData()
{
Statistics s = new Statistics();
TaskManager t = new TaskManager("tm");
int done = s.getNumberDone();
int missed = s.getMissed();
donelbl.setText("Done: " + done);
missedlbl.setText("Missed: " + missed);
totallbl.setText("Total Habits: " + t.getHabits().size());
}
}