A lib directory to the project with gson library.
[Persons_Comparator.git] / src / MainWindowsView.java
index 065c90d8050f0deb9203ce7733bb26b49b64c029..729a9ad20382654cc21213f283a6f455e7d9f0c8 100644 (file)
@@ -1,8 +1,11 @@
 import javax.swing.*;
 import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.util.ArrayList;
 
 public class MainWindowsView extends JFrame {
+
     MainWindowsView(String title) {
         //Create and set up the window.
         setTitle(title);
@@ -10,6 +13,20 @@ public class MainWindowsView extends JFrame {
         setLocationRelativeTo(null);
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
+        //Create menu
+        JMenuBar menuBar = new JMenuBar();
+        setJMenuBar(menuBar);
+        JMenu fileMenu = new JMenu("File");
+        menuBar.add(fileMenu);
+        JMenuItem exit = new JMenuItem("Exit");
+        exit.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                System.exit(0);
+            }
+        });
+        fileMenu.add(exit);
+
+        //Main pane
         JPanel panel = new PersonView();
 
         //Get all Swing/AWT primitive components in the views and add them to the panel.
@@ -40,5 +57,4 @@ public class MainWindowsView extends JFrame {
         //this.pack();
         this.setVisible(true);
     }
-
-}
+}
\ No newline at end of file