diff --git a/pom.xml b/pom.xml
index e68cea0..fdc3695 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,5 +8,36 @@
SQL-Assesser-2
1.0-SNAPSHOT
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.0
+
+ 12
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 3.1.0
+
+ UTF-8
+
+
+
+
+
+
+
+
+
+ org.xerial
+ sqlite-jdbc
+ 3.30.1
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/gyrobian/SQLAssesser2.java b/src/main/java/com/gyrobian/SQLAssesser2.java
new file mode 100644
index 0000000..9b53db7
--- /dev/null
+++ b/src/main/java/com/gyrobian/SQLAssesser2.java
@@ -0,0 +1,14 @@
+package com.gyrobian;
+
+import com.gyrobian.view.Window;
+
+/**
+ * The main class of the application.
+ */
+public class SQLAssesser2 {
+
+ public static void main(String[] args) {
+ Window window = new Window();
+ window.init();
+ }
+}
diff --git a/src/main/java/com/gyrobian/listener/ClearTextComponentListener.java b/src/main/java/com/gyrobian/listener/ClearTextComponentListener.java
new file mode 100644
index 0000000..e139dfd
--- /dev/null
+++ b/src/main/java/com/gyrobian/listener/ClearTextComponentListener.java
@@ -0,0 +1,26 @@
+package com.gyrobian.listener;
+
+import javax.swing.text.JTextComponent;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ * Listener for when a user clicks a button to clear a text component.
+ */
+public class ClearTextComponentListener implements ActionListener {
+ private final JTextComponent textComponent;
+
+ public ClearTextComponentListener(JTextComponent textComponent) {
+ this.textComponent = textComponent;
+ }
+
+ /**
+ * Invoked when an action occurs.
+ *
+ * @param e the event to be processed
+ */
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ this.textComponent.setText(null);
+ }
+}
diff --git a/src/main/java/com/gyrobian/listener/LoadTextComponentFromFileListener.java b/src/main/java/com/gyrobian/listener/LoadTextComponentFromFileListener.java
new file mode 100644
index 0000000..7a4056c
--- /dev/null
+++ b/src/main/java/com/gyrobian/listener/LoadTextComponentFromFileListener.java
@@ -0,0 +1,38 @@
+package com.gyrobian.listener;
+
+import com.gyrobian.util.FileLoader;
+
+import javax.swing.*;
+import javax.swing.filechooser.FileNameExtensionFilter;
+import javax.swing.text.JTextComponent;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ * Listener for when a user clicks to load the contents of a file into a text component.
+ */
+public class LoadTextComponentFromFileListener implements ActionListener {
+ private final JTextComponent textComponent;
+
+ public LoadTextComponentFromFileListener(JTextComponent textComponent) {
+ this.textComponent = textComponent;
+ }
+
+ /**
+ * Invoked when an action occurs.
+ *
+ * @param e the event to be processed
+ */
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setFileFilter(new FileNameExtensionFilter("SQL, Text", "sql", "txt"));
+ fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ fileChooser.setMultiSelectionEnabled(false);
+
+ int result = fileChooser.showOpenDialog(textComponent);
+ if (result == JFileChooser.APPROVE_OPTION) {
+ this.textComponent.setText(FileLoader.readFile(fileChooser.getSelectedFile()));
+ }
+ }
+}
diff --git a/src/main/java/com/gyrobian/util/FileLoader.java b/src/main/java/com/gyrobian/util/FileLoader.java
new file mode 100644
index 0000000..85bbbcb
--- /dev/null
+++ b/src/main/java/com/gyrobian/util/FileLoader.java
@@ -0,0 +1,51 @@
+package com.gyrobian.util;
+
+import java.io.*;
+
+/**
+ * Helps with loading files.
+ */
+public class FileLoader {
+
+ /**
+ * Reads a resource file from the classpath, and returns its contents as a string.
+ * @param classPath The class path of the resource.
+ * @return The string containing the contents of the file.
+ * @throws IOException If an error occurred or the file could not be read.
+ */
+ public static String readResource(String classPath) throws IOException {
+ String newLine = System.getProperty("line.separator");
+ InputStream is = FileLoader.class.getClassLoader().getResourceAsStream(classPath);
+ if (is == null) {
+ throw new IOException("Could not open input stream to resource.");
+ }
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+ StringBuilder result = new StringBuilder();
+ boolean flag = false;
+ for (String line; (line = reader.readLine()) != null; ) {
+ result.append(flag? newLine: "").append(line);
+ flag = true;
+ }
+ return result.toString();
+ }
+
+ /**
+ * Reads a file into a string.
+ * @param selectedFile The file object, as it is often selected by a JFileChooser.
+ * @return The string containing the file, or an empty string.
+ */
+ public static String readFile(File selectedFile) {
+ try (BufferedReader reader = new BufferedReader(new FileReader(selectedFile))) {
+ String line;
+ StringBuilder sb = new StringBuilder();
+ while ((line = reader.readLine()) != null) {
+ sb.append(line);
+ sb.append('\n');
+ }
+ return sb.toString();
+ } catch (IOException e) {
+ e.printStackTrace();
+ return "";
+ }
+ }
+}
diff --git a/src/main/java/com/gyrobian/view/Window.form b/src/main/java/com/gyrobian/view/Window.form
new file mode 100644
index 0000000..cd80c66
--- /dev/null
+++ b/src/main/java/com/gyrobian/view/Window.form
@@ -0,0 +1,257 @@
+
+
diff --git a/src/main/java/com/gyrobian/view/Window.java b/src/main/java/com/gyrobian/view/Window.java
new file mode 100644
index 0000000..82fd859
--- /dev/null
+++ b/src/main/java/com/gyrobian/view/Window.java
@@ -0,0 +1,66 @@
+package com.gyrobian.view;
+
+import com.gyrobian.listener.ClearTextComponentListener;
+import com.gyrobian.listener.LoadTextComponentFromFileListener;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * The window that's used for displaying the application.
+ */
+public class Window extends JFrame {
+ private JPanel mainPanel;
+ private JPanel assessmentPanel;
+ private JPanel inputPanel;
+ private JPanel templateInputPanel;
+ private JPanel testingInputPanel;
+ private JPanel outputPanel;
+ private JTextArea templateTextArea;
+ private JPanel templateTextEditorPanel;
+ private JPanel testingTextEditorPanel;
+ private JTextArea testingTextArea;
+ private JButton loadTemplateFromFileButton;
+ private JButton clearTemplateButton;
+ private JButton loadTestingFromFileButton;
+ private JButton clearTestingButton;
+ private JPanel templateTextEditorButtonPanel;
+ private JPanel testingTextEditorButtonPanel;
+ private JLabel outputPanelTitle;
+ private JPanel templateOutputPanel;
+ private JPanel testingOutputPanel;
+ private JTextPane templateOutputTextPane;
+ private JTextPane testingOutputTextPane;
+ private JLabel assessmentPanelTitle;
+ private JTextPane assessmentTextPane;
+
+ public Window() {
+ super("SQL-Assesser-2");
+ }
+
+ /**
+ * Initializes the window and makes it visible.
+ */
+ public void init() {
+ this.initializeEventListeners();
+
+ this.setContentPane(mainPanel);
+ this.pack();
+ this.setExtendedState(this.getExtendedState() | Frame.MAXIMIZED_BOTH);
+ this.setLocationRelativeTo(null);
+ this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
+
+ this.setVisible(true);
+ }
+
+ /**
+ * Initializes all event listening for any components that need it.
+ */
+ private void initializeEventListeners() {
+ this.clearTemplateButton.addActionListener(new ClearTextComponentListener(this.templateTextArea));
+ this.clearTestingButton.addActionListener(new ClearTextComponentListener(this.testingTextArea));
+
+ this.loadTemplateFromFileButton.addActionListener(new LoadTextComponentFromFileListener(this.templateTextArea));
+ this.loadTestingFromFileButton.addActionListener(new LoadTextComponentFromFileListener(this.testingTextArea));
+ }
+}