Skip to content
Snippets Groups Projects
Commit 34ff591e authored by joalhelk's avatar joalhelk
Browse files

close the timer

parent 937c067f
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,7 @@ public class WelcomePage implements MouseListener, ActionListener { ...@@ -52,6 +52,7 @@ public class WelcomePage implements MouseListener, ActionListener {
private static JFrame frame; private static JFrame frame;
private static JLabel chosen_label; private static JLabel chosen_label;
private static final Timer timer = new Timer();
private static NodeDataFrame nodeDataFrame = new NodeDataFrame(leftPanelWidth, topPanelHeight, width-leftPanelWidth, height-topPanelHeight-bottomPanelHeight); private static NodeDataFrame nodeDataFrame = new NodeDataFrame(leftPanelWidth, topPanelHeight, width-leftPanelWidth, height-topPanelHeight-bottomPanelHeight);
private static NodeSettingsFrame nodeSettingFrame = new NodeSettingsFrame(width-leftPanelWidth, height-topPanelHeight-bottomPanelHeight); private static NodeSettingsFrame nodeSettingFrame = new NodeSettingsFrame(width-leftPanelWidth, height-topPanelHeight-bottomPanelHeight);
...@@ -202,8 +203,6 @@ public class WelcomePage implements MouseListener, ActionListener { ...@@ -202,8 +203,6 @@ public class WelcomePage implements MouseListener, ActionListener {
* Polls the backend for new data every given interval * Polls the backend for new data every given interval
*/ */
private static void PollData() { private static void PollData() {
final Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() { timer.scheduleAtFixedRate(new TimerTask() {
int timeRemaining = pollInterval; int timeRemaining = pollInterval;
public void run() { public void run() {
...@@ -300,6 +299,7 @@ public class WelcomePage implements MouseListener, ActionListener { ...@@ -300,6 +299,7 @@ public class WelcomePage implements MouseListener, ActionListener {
if(result == JOptionPane.YES_OPTION) { if(result == JOptionPane.YES_OPTION) {
User.clear(); User.clear();
timer.cancel();
frame.dispose(); frame.dispose();
LoginPage login = new LoginPage(); LoginPage login = new LoginPage();
} }
...@@ -389,6 +389,7 @@ public class WelcomePage implements MouseListener, ActionListener { ...@@ -389,6 +389,7 @@ public class WelcomePage implements MouseListener, ActionListener {
JOptionPane.showConfirmDialog(frame, message, title, JOptionPane.showConfirmDialog(frame, message, title,
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
User.clear(); User.clear();
timer.cancel();
frame.dispose(); frame.dispose();
LoginPage login = new LoginPage(); LoginPage login = new LoginPage();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment