-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWeatherUI.java
215 lines (158 loc) · 3.89 KB
/
WeatherUI.java
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
package weatherapp.gui;
import weatherapp.WeatherEngine;
import javax.swing.*;
import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.image.*;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class WeatherUI extends Application
{
private WeatherEngine engine;
@FXML
private Label lbForecast;
@FXML
private Label lbCurrentDay;
@FXML
private Label lbTemp;
@FXML
private Label lbCity;
@FXML
private Label lbStatus;
@FXML
private Label lbStatusMon;
@FXML
private Label lbStatusTue;
@FXML
private Label lbStatusWed;
@FXML
private Label lbStatusThu;
@FXML
private Label lbStatusFri;
@FXML
private Label lbStatus12am;
@FXML
private Label lbStatus3am;
@FXML
private Label lbStatus6am;
@FXML
private Label lbStatus9am;
@FXML
private Label lbStatus12pm;
@FXML
private Label lbStatus3pm;
@FXML
private Label lbStatus6pm;
@FXML
private Label lbStatus9pm;
@FXML
private Label lbHiLo;
@FXML
private Label lbHiLoMon;
@FXML
private Label lbHiLoTue;
@FXML
private Label lbHiLoWed;
@FXML
private Label lbHiLoThu;
@FXML
private Label lbHiLoFri;
@FXML
private Label lbHiLo12am;
@FXML
private Label lbHiLo3am;
@FXML
private Label lbHiLo6am;
@FXML
private Label lbHiLo9am;
@FXML
private Label lbHiLo12pm;
@FXML
private Label lbHiLo3pm;
@FXML
private Label lbHiLo6pm;
@FXML
private Label lbHiLo9pm;
@FXML
private ImageView imgStatus;
@FXML
private ImageView imgStatus12am;
@FXML
private ImageView imgStatus3am;
@FXML
private ImageView imgStatus6am;
@FXML
private ImageView imgStatus9am;
@FXML
private ImageView imgStatus12pm;
@FXML
private ImageView imgStatus3pm;
@FXML
private ImageView imgStatus6pm;
@FXML
private ImageView imgStatus9pm;
@FXML
private ImageView imgStatusMon;
@FXML
private ImageView imgStatusTue;
@FXML
private ImageView imgStatusWed;
@FXML
private ImageView imgStatusThu;
@FXML
private ImageView imgStatusFri;
@FXML
private Button btnSearch;
@FXML
private TextField txtSearchCity;
public WeatherUI() throws Exception
{
this.engine = new WeatherEngine();
// mainPanel.updateUI();
// createBtnOne();
}
/*
* public void showMainFrame() throws Exception {
* JFrame frame = new JFrame("Weather App");
* frame.setContentPane(new WeatherUI().mainFrame);
* frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
* frame.pack();
* setLocationRelativeTo(null);
* frame.setVisible(true);
* }
*
* private void createBtnOne() {
* btnOne.addActionListener(actionEvent -> lblHello.setVisible(true));
* }
*
*/
@Override
public void start(Stage primaryStage) throws Exception {
try
{
Parent root = FXMLLoader.load(getClass().getResource("WeatherGUI.fxml"));
Scene scene = new Scene(root);
primaryStage.setTitle("Weather App");
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e)
{
JOptionPane.showMessageDialog(null, "Cannot load Primary Window! Exiting Program..."
, e.getMessage(), JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
}
@FXML
void searchCity()
{
// TODO write code that searches for the city here.
}
public void init()
{
// TODO write code that sets the labels and/or graphics equal to the WeatherApp fields.
}
}