From ec387f611b1bcb0349caad2f3fbd185b72e27e3f Mon Sep 17 00:00:00 2001 From: joalhelk <joalhelk@jyu.fi> Date: Wed, 19 Jan 2022 21:39:49 +0200 Subject: [PATCH] fixed a bug on combobox --- .../watcherGui/frames/WelcomePage.java | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/WatcherGui/src/main/java/com/joelhelkala/watcherGui/frames/WelcomePage.java b/WatcherGui/src/main/java/com/joelhelkala/watcherGui/frames/WelcomePage.java index a6885d0..fda5ae2 100644 --- a/WatcherGui/src/main/java/com/joelhelkala/watcherGui/frames/WelcomePage.java +++ b/WatcherGui/src/main/java/com/joelhelkala/watcherGui/frames/WelcomePage.java @@ -49,9 +49,7 @@ public class WelcomePage implements MouseListener, ActionListener { private static NodeDataFrame nodeDataFrame = new NodeDataFrame(leftPanelWidth, topPanelHeight, width-leftPanelWidth, height-topPanelHeight-bottomPanelHeight); private static NodeSettingsFrame nodeSettingFrame = new NodeSettingsFrame(width-leftPanelWidth, height-topPanelHeight-bottomPanelHeight); - public WelcomePage(){ - Nodes.updateNodes(); - + public WelcomePage(){ frame = new JFrame(); frame.getContentPane().setBackground( Color.MAGENTA ); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -66,18 +64,7 @@ public class WelcomePage implements MouseListener, ActionListener { topPanel.setLayout(null); frame.getContentPane().add(topPanel); - for(int i = 0; i < Nodes.size(); i++) { - comboBox.addItem(Nodes.get(i).getLocation()); - } - - String selected = (String) comboBox.getSelectedItem(); - Node node = Nodes.findByLocation(selected); - - if(node != null) { - node.updateData(HttpRequests.getNodeData(node.getId())); - nodeDataFrame.updateData(node); - nodeSettingFrame.updateInformation(node); - } + updateComboBox(); comboBox.addActionListener(this); comboBox.setBounds(500, 10, 200, 50); -- GitLab