From cc7c10a15e9272d34031d6b6e5585feac4cbdd79 Mon Sep 17 00:00:00 2001
From: Camil Staps
Date: Wed, 22 Apr 2015 20:49:52 +0200
Subject: week 10
---
 .gitignore                                         |    2 +
 Week10 Weather GUI/build.xml                       |   73 +
 Week10 Weather GUI/manifest.mf                     |    3 +
 Week10 Weather GUI/nbproject/build-impl.xml        | 1413 ++++++++++++++++++++
 Week10 Weather GUI/nbproject/genfiles.properties   |    8 +
 Week10 Weather GUI/nbproject/project.properties    |   75 ++
 Week10 Weather GUI/nbproject/project.xml           |   15 +
 .../com/camilstaps/week10/OverviewController.java  |  149 +++
 .../src/com/camilstaps/week10/OverviewWindow.java  |  115 ++
 .../src/com/camilstaps/week10/WeatherStation.java  |   86 ++
 .../com/camilstaps/week10/Week10WeatherGUI.java    |   51 +
 11 files changed, 1990 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Week10 Weather GUI/build.xml
 create mode 100644 Week10 Weather GUI/manifest.mf
 create mode 100644 Week10 Weather GUI/nbproject/build-impl.xml
 create mode 100644 Week10 Weather GUI/nbproject/genfiles.properties
 create mode 100644 Week10 Weather GUI/nbproject/project.properties
 create mode 100644 Week10 Weather GUI/nbproject/project.xml
 create mode 100644 Week10 Weather GUI/src/com/camilstaps/week10/OverviewController.java
 create mode 100644 Week10 Weather GUI/src/com/camilstaps/week10/OverviewWindow.java
 create mode 100644 Week10 Weather GUI/src/com/camilstaps/week10/WeatherStation.java
 create mode 100644 Week10 Weather GUI/src/com/camilstaps/week10/Week10WeatherGUI.java
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..42b2d22
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/Week10 Weather GUI/nbproject/private/
+/Week10 Weather GUI/build/
\ No newline at end of file
diff --git a/Week10 Weather GUI/build.xml b/Week10 Weather GUI/build.xml
new file mode 100644
index 0000000..ef0a64f
--- /dev/null
+++ b/Week10 Weather GUI/build.xml	
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+    Builds, tests, and runs the project Week10 Weather GUI.
+    
+    
+
diff --git a/Week10 Weather GUI/manifest.mf b/Week10 Weather GUI/manifest.mf
new file mode 100644
index 0000000..328e8e5
--- /dev/null
+++ b/Week10 Weather GUI/manifest.mf	
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/Week10 Weather GUI/nbproject/build-impl.xml b/Week10 Weather GUI/nbproject/build-impl.xml
new file mode 100644
index 0000000..eca5bb1
--- /dev/null
+++ b/Week10 Weather GUI/nbproject/build-impl.xml	
@@ -0,0 +1,1413 @@
+
+
+
+    
+        
+            
+                
+            
+        
+    
+    
+    
+    
+        
+        
+    
+    
+        
+        
+        
+    
+    
+        
+        
+        
+        
+        
+    
+    
+        
+        
+    
+    
+        
+        
+        
+            
+                
+                    
+                
+                
+            
+        
+        
+            
+                
+                
+                    
+                
+            
+        
+        
+            
+                
+                
+                
+            
+        
+        
+            
+                
+                    
+                
+                
+            
+        
+        
+            
+                
+                
+                
+                    
+                
+            
+        
+        
+            
+                
+                
+            
+        
+        
+            
+                
+                
+            
+        
+        
+            
+                
+                
+            
+        
+        
+            
+                
+                
+            
+        
+        
+            
+                
+            
+        
+        
+            
+                
+            
+        
+        
+            
+                
+                
+            
+        
+        
+            
+                
+                
+            
+        
+        
+        
+        
+        
+        
+            
+                
+            
+        
+        
+        
+        
+        
+        
+        
+            
+                
+                
+                    
+                
+            
+        
+        
+        
+        
+        
+        
+            
+        
+        
+        
+            
+                
+                
+                    
+                
+            
+        
+        
+            
+        
+        
+            
+                
+                
+                    
+                
+            
+        
+        
+        
+        
+        
+        
+        
+            
+                
+                
+            
+        
+        
+            
+        
+        
+            
+                
+                
+            
+        
+        
+            
+        
+        
+            
+        
+    
+    
+        
+        
+    
+    
+        Must set src.dir
+        Must set test.src.dir
+        Must set build.dir
+        Must set dist.dir
+        Must set build.classes.dir
+        Must set dist.javadoc.dir
+        Must set build.test.classes.dir
+        Must set build.test.results.dir
+        Must set build.classes.excludes
+        Must set dist.jar
+    
+    
+        
+            
+            
+            
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+                
+                
+                
+                
+                    
+                        
+                            
+                        
+                    
+                    
+                        
+                    
+                    
+                    
+                    
+                    
+                    
+                    
+                    
+                    
+                    
+                    
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+            
+                
+                
+                
+                    
+                        
+                            
+                        
+                    
+                    
+                        
+                    
+                    
+                    
+                    
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+                
+                    
+                        
+                    
+                
+            
+        
+        
+            
+            
+                Must set javac.includes
+                
+                    
+                        
+                    
+                    
+                
+                
+                
+                
+                    
+                
+                
+                    
+                
+            
+        
+    
+    
+        
+            
+                
+                
+                    
+                
+            
+        
+        
+            
+                
+                
+            
+        
+    
+    
+        
+        
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+                
+                
+                    
+                    
+                        
+                        
+                    
+                    
+                    
+                    
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+                
+                
+                    
+                        
+                            
+                        
+                        
+                            
+                        
+                    
+                    
+                        
+                        
+                    
+                    
+                    
+                    
+                    
+                
+            
+        
+    
+    
+    
+        
+            
+            
+            
+            
+            
+            
+                
+                    
+                
+                
+                    
+                        
+                    
+                
+                
+                
+                    
+                    
+                        
+                        
+                    
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+                No tests executed.
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+                
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+                
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+                
+                    
+                        
+                            
+                        
+                        
+                        
+                        
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+                
+                
+                    
+                    
+                        
+                        
+                    
+                    
+                    
+                    
+                    
+                    
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+                
+                
+                    
+                        
+                            
+                        
+                        
+                            
+                        
+                    
+                    
+                        
+                        
+                    
+                    
+                    
+                    
+                    
+                    
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+                
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+                
+                    
+                
+                
+                    
+                
+                
+                
+                
+                    
+                        
+                        
+                        
+                        
+                        
+                        
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+                
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+            
+                
+                    
+                        
+                            
+                        
+                        
+                        
+                        
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+            
+            
+                
+                    
+                        
+                            
+                            
+                        
+                    
+                
+            
+        
+    
+    
+    
+    
+    
+        
+        
+    
+    
+        
+        
+    
+    
+        
+            
+            
+            
+                
+            
+        
+        
+            
+            
+            
+                
+                
+                
+                    
+                    
+                    
+                    
+                    
+                    
+                        
+                    
+                    
+                        
+                        
+                    
+                    
+                
+            
+        
+    
+    
+        Must set JVM to use for profiling in profiler.info.jvm
+        Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+    
+    
+    
+        
+            
+            
+            
+            
+                
+                    
+                        
+                    
+                
+            
+        
+        
+            
+            
+                
+                    
+                        
+                    
+                
+            
+        
+    
+    
+        
+        
+            
+                
+                
+                
+                
+            
+        
+        
+            
+        
+        
+            
+        
+        
+            
+        
+    
+    
+        
+            
+            
+            
+            
+                
+                    
+                    
+                    
+                    
+                    
+                    
+                    
+                    
+                        
+                    
+                    
+                        
+                        
+                    
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+            
+            
+                
+                    
+                    
+                    
+                    
+                    
+                    
+                        
+                    
+                    
+                        
+                        
+                    
+                    
+                
+            
+        
+    
+    
+        
+            
+            
+            
+                
+                
+                    
+                    
+                
+                
+                    
+                    
+                        
+                        
+                            
+                        
+                        
+                    
+                
+                
+                
+                    
+                    
+                        
+                        
+                    
+                
+            
+        
+    
+    
+        
+            
+                
+            
+        
+    
+    
+        
+        
+        
+        
+        
+        
+        
+            
+                
+            
+        
+    
+    
+        
+            
+        
+        
+            
+        
+    
+    
+        
+    
+    
+    
+    
+        
+        
+    
+    
+        
+    
+    
+        
+        
+        
+        
+        
+            
+        
+    
+    
+    
+        
+    
+    
+        
+    
+    
+        
+    
+    
+        
+        
+    
+    
+        
+            
+                
+            
+        
+        
+    
+    
+        
+        
+            
+        
+    
+    
+        
+        
+            
+        
+    
+    
+        
+        
+    
+    
+    
+        
+        
+    
+    
+        Must select some files in the IDE or set javac.includes
+        
+        
+    
+    
+        
+        
+    
+    
+    
+    
+        
+        
+    
+    
+        
+        
+    
+    
+        
+        
+    
+    
+        
+        
+    
+    
+        
+            
+        
+    
+    
+        
+            
+        
+    
+    
+        
+        
+        
+        
+            
+        
+    
+    
+        
+        To run this application from the command line without Ant, try:
+        
+        java -jar "${dist.jar.resolved}"
+    
+    
+        
+        
+        
+        
+            
+            
+        
+        
+            
+        
+        
+            
+        
+        
+    
+    
+        
+            
+        
+    
+    
+    
+    
+        
+        
+    
+    
+    
+    
+    
+        
+            
+                
+            
+        
+    
+    
+        
+    
+    
+        Must select one file in the IDE or set run.class
+        
+    
+    
+        Must select one file in the IDE or set run.class
+        
+    
+    
+    
+        
+    
+    
+        
+    
+    
+        
+            
+                
+            
+        
+    
+    
+    
+        
+    
+    
+    
+        Must select one file in the IDE or set debug.class
+        
+    
+    
+    
+        Must select one file in the IDE or set debug.class
+        
+    
+    
+    
+        Must set fix.includes
+        
+    
+    
+        
+    
+    
+    
+    
+    
+        This target only works when run from inside the NetBeans IDE.
+        
+            
+                
+            
+        
+        
+    
+    
+        Must select one file in the IDE or set profile.class
+        This target only works when run from inside the NetBeans IDE.
+        
+            
+                
+            
+        
+        
+    
+    
+        This target only works when run from inside the NetBeans IDE.
+        
+            
+                
+            
+        
+        
+            
+                
+            
+        
+    
+    
+        This target only works when run from inside the NetBeans IDE.
+        
+            
+                
+            
+        
+        
+            
+            
+            
+            
+            
+                
+            
+            
+                
+                
+            
+            
+            
+        
+    
+    
+    
+        
+            
+                
+                
+            
+        
+    
+    
+        
+        
+    
+    
+        Must select one file in the IDE or set run.class
+        
+        
+    
+    
+    
+        Must select some files in the IDE or set test.includes
+        
+        
+    
+    
+        Must select one file in the IDE or set run.class
+        
+        
+    
+    
+        Must select one file in the IDE or set applet.url
+        
+        
+    
+    
+    
+        
+        
+            
+                
+                
+                    
+                
+            
+        
+        
+            
+        
+        
+            
+                
+            
+            
+                
+            
+            
+                
+                
+            
+            
+        
+        
+            
+                
+            
+            
+                
+            
+        
+    
+    
+        
+    
+    
+    
+    
+        
+    
+    
+        
+        
+    
+    
+        
+    
+    
+        
+        
+            
+        
+    
+    
+        
+        
+    
+    
+    
+        
+        
+    
+    
+        Must select some files in the IDE or set javac.includes
+        
+        
+        
+            
+        
+    
+    
+        
+        
+    
+    
+    
+    
+        
+    
+    
+        
+    
+    
+        Some tests failed; see details above.
+    
+    
+    
+    
+    
+        
+    
+    
+        Must select some files in the IDE or set test.includes
+        
+    
+    
+        Some tests failed; see details above.
+    
+    
+    
+        Must select some files in the IDE or set test.class
+        Must select some method in the IDE or set test.method
+        
+    
+    
+        Some tests failed; see details above.
+    
+    
+    
+    
+        Must select one file in the IDE or set test.class
+        
+    
+    
+        Must select one file in the IDE or set test.class
+        Must select some method in the IDE or set test.method
+        
+    
+    
+        
+    
+    
+    
+    
+        
+    
+    
+    
+    
+        Must select one file in the IDE or set applet.url
+        
+            
+                
+            
+        
+    
+    
+    
+        Must select one file in the IDE or set applet.url
+        
+            
+                
+            
+        
+    
+    
+    
+    
+        
+        
+    
+    
+        
+    
+    
+        
+        
+        
+        
+        
+            
+        
+    
+    
+        
+        
+    
+    
+        
+        
+    
+    
+    
+        
+        
+            
+                
+                    
+                
+                
+            
+        
+    
+    
+        
+            
+                
+                
+            
+        
+    
+
diff --git a/Week10 Weather GUI/nbproject/genfiles.properties b/Week10 Weather GUI/nbproject/genfiles.properties
new file mode 100644
index 0000000..00b778f
--- /dev/null
+++ b/Week10 Weather GUI/nbproject/genfiles.properties	
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=7492faa3
+build.xml.script.CRC32=72b7a3aa
+build.xml.stylesheet.CRC32=8064a381@1.75.2.48
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=7492faa3
+nbproject/build-impl.xml.script.CRC32=ac1273a3
+nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
diff --git a/Week10 Weather GUI/nbproject/project.properties b/Week10 Weather GUI/nbproject/project.properties
new file mode 100644
index 0000000..b001db7
--- /dev/null
+++ b/Week10 Weather GUI/nbproject/project.properties	
@@ -0,0 +1,75 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=Week10 Weather GUI
+application.vendor=camilstaps
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+    ${run.classpath}
+debug.test.classpath=\
+    ${run.test.classpath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/Week10_Weather_GUI.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+endorsed.classpath=
+excludes=
+includes=**
+jar.compress=false
+javac.classpath=
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.processorpath=\
+    ${javac.classpath}
+javac.source=1.7
+javac.target=1.7
+javac.test.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}
+javac.test.processorpath=\
+    ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=com.camilstaps.week10.Week10WeatherGUI
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=
+run.test.classpath=\
+    ${javac.test.classpath}:\
+    ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/Week10 Weather GUI/nbproject/project.xml b/Week10 Weather GUI/nbproject/project.xml
new file mode 100644
index 0000000..099237c
--- /dev/null
+++ b/Week10 Weather GUI/nbproject/project.xml	
@@ -0,0 +1,15 @@
+
+
+    org.netbeans.modules.java.j2seproject
+    
+        
+            Week10 Weather GUI
+            
+                
+            
+            
+                
+            
+        
+    
+
diff --git a/Week10 Weather GUI/src/com/camilstaps/week10/OverviewController.java b/Week10 Weather GUI/src/com/camilstaps/week10/OverviewController.java
new file mode 100644
index 0000000..64e39f9
--- /dev/null
+++ b/Week10 Weather GUI/src/com/camilstaps/week10/OverviewController.java	
@@ -0,0 +1,149 @@
+/*
+ * The MIT License (MIT)
+ * 
+ * Copyright (c) 2015 Camil Staps 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.camilstaps.week10;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.ImageIcon;
+import javax.swing.JComboBox;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * Controller for the main window
+ * @author Camil Staps, s4498062
+ */
+public class OverviewController {
+    
+    /**
+     * Location of the Buienradar API XML
+     */
+    private final static String XML_LOCATION = "http://xml.buienradar.nl";
+    
+    private final OverviewWindow overviewWindow;
+    private List weatherStations;
+    
+    /**
+     * Refresh button:
+     *  1. Store selected weatherstation id
+     *  2. Reload XML
+     *  3. Restore previously selected weatherstation
+     */
+    private final ActionListener refreshActionListener = new ActionListener() {
+        @Override
+        public void actionPerformed(ActionEvent ae) {
+            if (ae.getActionCommand().equals("Refresh")) {
+                int id = ((WeatherStation) overviewWindow.getWeatherStationPicker().getSelectedItem()).getId();
+                
+                loadXML();
+                
+                for (WeatherStation ws : weatherStations) {
+                    if (ws.getId() == id) {
+                        overviewWindow.getWeatherStationPicker().setSelectedItem(ws);
+                        break;
+                    }
+                }
+                
+                loadWeatherInfo();
+            }
+        }
+    };
+    
+    /**
+     * When the ComboBox changes, change the information in the label accordingly
+     */
+    private final ActionListener newStationActionListener = new ActionListener() {
+        @Override
+        public void actionPerformed(ActionEvent ae) {
+            if (ae.getActionCommand().equals("comboBoxChanged")) {
+                loadWeatherInfo();
+            }
+        }
+    };
+    
+    /**
+     * Load the XML for the first time, register ActionListeners and display info
+     * @param ow 
+     */
+    public OverviewController(OverviewWindow ow) {
+        overviewWindow = ow;
+        
+        loadXML();
+        
+        overviewWindow.getRefreshButton().addActionListener(refreshActionListener);
+        overviewWindow.getWeatherStationPicker().addActionListener(newStationActionListener);
+        
+        loadWeatherInfo();
+    }
+    
+    /**
+     * Load XML from the Buienradar API and store in the weatherStations List.
+     */
+    private void loadXML() {
+        try {
+            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+            Document doc = docBuilder.parse(XML_LOCATION);
+            
+            doc.getDocumentElement().normalize();
+            NodeList weatherstationsList = doc.getElementsByTagName("weerstation");
+            weatherStations = new ArrayList<>();
+            for (int i = 0; i < weatherstationsList.getLength(); i++) {
+                weatherStations.add(new WeatherStation((Element) weatherstationsList.item(i)));
+            }
+            Collections.sort(weatherStations);
+            
+            JComboBox comboBox = overviewWindow.getWeatherStationPicker();
+            comboBox.removeAllItems();
+            for (WeatherStation ws : weatherStations) {
+                comboBox.addItem(ws);
+            }
+        } catch (ParserConfigurationException | SAXException | IOException ex) {
+            Logger.getLogger(Week10WeatherGUI.class.getName()).log(Level.SEVERE, null, ex);
+        }
+    }
+    
+    /**
+     * Show the weather information in the display.
+     */
+    private void loadWeatherInfo() {
+        WeatherStation selected = (WeatherStation) overviewWindow.getWeatherStationPicker().getSelectedItem();
+        if (selected != null) {
+            overviewWindow.getWeatherInformationDisplay().setText(selected.getWeatherDescription());
+            overviewWindow.getWeatherInformationDisplay().setIcon(new ImageIcon(selected.getWeatherIcon()));
+        }
+    }
+    
+}
diff --git a/Week10 Weather GUI/src/com/camilstaps/week10/OverviewWindow.java b/Week10 Weather GUI/src/com/camilstaps/week10/OverviewWindow.java
new file mode 100644
index 0000000..7f021f6
--- /dev/null
+++ b/Week10 Weather GUI/src/com/camilstaps/week10/OverviewWindow.java	
@@ -0,0 +1,115 @@
+/*
+ * The MIT License (MIT)
+ * 
+ * Copyright (c) 2015 Camil Staps 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.camilstaps.week10;
+
+import java.awt.GridLayout;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+/**
+ * The main window of the application
+ * @author Camil Staps, s4498062
+ */
+public class OverviewWindow extends JFrame {
+    
+    /**
+     * Width and height of the window
+     */
+    private static final int THE_WIDTH = 460, THE_HEIGHT = 200;
+    
+    /**
+     * The options panel: select weather station & refresh
+     */
+    private final JPanel optionsPanel = new JPanel();
+    private final JComboBox weatherStationPicker = new JComboBox<>();
+    private final JButton refreshButton = new JButton("Refresh");
+
+    /**
+     * The display panel: a label for both the weather icon and the text
+     */
+    private final JPanel displayPanel = new JPanel();
+    private final JLabel weatherInformationDisplay = new JLabel();
+    
+    /**
+     * Set everything up
+     */
+    public OverviewWindow() {
+        super("Weather information");
+        
+        setSize(THE_WIDTH, THE_HEIGHT);
+        setVisible(true);
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        setLayout(new GridLayout(2,1));
+        
+        setupOptionsPanel();
+        setupDisplayPanel();
+    }
+    
+    /**
+     * Get the JComboBox for selecting the WeatherStation
+     * @return 
+     */
+    public JComboBox getWeatherStationPicker() {
+        return weatherStationPicker;
+    }
+    
+    /**
+     * Get the JLabel for displaying weather information
+     * @return 
+     */
+    public JLabel getWeatherInformationDisplay() {
+        return weatherInformationDisplay;
+    }
+    
+    /**
+     * Get the JButton for refreshing content
+     * @return 
+     */
+    public JButton getRefreshButton() {
+        return refreshButton;
+    }
+    
+    /**
+     * Create the options panel
+     */
+    private void setupOptionsPanel() {
+        optionsPanel.add(weatherStationPicker);
+        optionsPanel.add(refreshButton);
+        
+        add(optionsPanel);
+    }
+    
+    /**
+     * Create the display panel
+     */
+    private void setupDisplayPanel() {
+        displayPanel.add(weatherInformationDisplay);
+        
+        add(displayPanel);
+    }
+    
+}
diff --git a/Week10 Weather GUI/src/com/camilstaps/week10/WeatherStation.java b/Week10 Weather GUI/src/com/camilstaps/week10/WeatherStation.java
new file mode 100644
index 0000000..719cec0
--- /dev/null
+++ b/Week10 Weather GUI/src/com/camilstaps/week10/WeatherStation.java	
@@ -0,0 +1,86 @@
+/*
+ * The MIT License (MIT)
+ * 
+ * Copyright (c) 2015 Camil Staps 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.camilstaps.week10;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.w3c.dom.Element;
+
+/**
+ * A WeatherStation with data fetched from the Buienradar API
+ * @author Camil Staps, s4498062
+ */
+public class WeatherStation implements Comparable {
+    
+    /**
+     * The Buienradar id; weatherstation name; description of the current weather; an icon for the weather
+     */
+    private final int id;
+    private final String name;
+    private final String weatherDescription;
+    private final URL weatherIcon;
+    
+    /**
+     * Create the WeatherStation from a DOM element (typically the weerstation element) of the XML
+     * @param elem 
+     */
+    public WeatherStation(Element elem) {
+        id = Integer.parseInt(elem.getAttribute("id"));
+        name = ((Element) elem.getElementsByTagName("stationnaam").item(0)).getTextContent().substring(12);
+        weatherDescription = ((Element) elem.getElementsByTagName("icoonactueel").item(0)).getAttribute("zin");
+        URL tempWeatherIcon = null;
+        try {
+            tempWeatherIcon = new URL(((Element) elem.getElementsByTagName("icoonactueel").item(0)).getTextContent());
+        } catch (NullPointerException | MalformedURLException ex) {
+        }
+        weatherIcon = tempWeatherIcon;
+    }
+    
+    public int getId() {
+        return id;
+    }
+    
+    public String getName() {
+        return name;
+    }
+    
+    public String getWeatherDescription() {
+        return weatherDescription;
+    }
+    
+    public URL getWeatherIcon() {
+        return weatherIcon;
+    }
+    
+    @Override
+    public String toString() {
+        return id + " (" + name + ")";
+    }
+
+    @Override
+    public int compareTo(WeatherStation t) {
+        return name.compareTo(t.name);
+    }
+    
+}
diff --git a/Week10 Weather GUI/src/com/camilstaps/week10/Week10WeatherGUI.java b/Week10 Weather GUI/src/com/camilstaps/week10/Week10WeatherGUI.java
new file mode 100644
index 0000000..9e17a7e
--- /dev/null
+++ b/Week10 Weather GUI/src/com/camilstaps/week10/Week10WeatherGUI.java	
@@ -0,0 +1,51 @@
+/*
+ * The MIT License (MIT)
+ * 
+ * Copyright (c) 2015 Camil Staps 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+package com.camilstaps.week10;
+
+/**
+ * Solutions to week 10 (Java Swing; Buienradar Weather API)
+ * @author Camil Staps, s4498062
+ */
+public class Week10WeatherGUI {
+    
+    private final OverviewWindow overviewWindow;
+    private final OverviewController overviewController;
+    
+    /**
+     * Create the main window, and its controller
+     */
+    public Week10WeatherGUI() {
+        overviewWindow = new OverviewWindow();
+        overviewController = new OverviewController(overviewWindow);
+    }
+
+    /**
+     * Main method
+     * @param args the command line arguments (ignored)
+     */
+    public static void main(String[] args) {
+        Week10WeatherGUI start = new Week10WeatherGUI();
+    }
+    
+}
-- 
cgit v1.2.3