Add a MainWindowsView class and use it in the main().
[Persons_Comparator.git] / src / MainWindowsView.java
diff --git a/src/MainWindowsView.java b/src/MainWindowsView.java
new file mode 100644 (file)
index 0000000..f4f837f
--- /dev/null
@@ -0,0 +1,30 @@
+import javax.swing.*;
+
+public class MainWindowsView extends JFrame {
+    MainWindowsView(String title) {
+        //Create and set up the window.
+        setTitle(title);
+        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        JPanel panel = new PersonView();
+
+        //TODO: Add content to the panel
+        //JLabel label = new JLabel("Hello World");
+        //panel.add(label);
+
+        getContentPane().add(panel);
+    }
+
+    /**
+     * Show the GUI. For thread safety,
+     * this method should be invoked from the
+     * event-dispatching thread.
+     */
+    public void showGUI() {
+
+        //Display the window.
+        this.pack();
+        this.setVisible(true);
+    }
+
+}