+ //Create menu
+ JMenuBar menuBar = createMenuBar();
+ setJMenuBar(menuBar);
+
+ //Get all Swing/AWT JPanel in the views and add them to the main panel.
+ ArrayList<Component> components = new ArrayList<>();
+ for (int i = 0; i < panel.getComponentCount(); i++) {
+ components.add(panel.getComponent(i));
+ }
+ for (Component component : components) {
+ panel.add(component);
+ }
+
+ panel.add(getCurrentPersonView().getNorthPanel(), BorderLayout.NORTH);
+ panel.add(getCurrentPersonView().getSouthPanel(), BorderLayout.SOUTH);
+ panel.add(getCurrentPersonView().getEastPanel(), BorderLayout.EAST);
+ panel.add(getCurrentPersonView().getWestPanel(), BorderLayout.WEST);
+ panel.add(getCurrentPersonView().getPersonPanel(), BorderLayout.CENTER);
+ }
+
+ public PersonView getCurrentPersonView() {
+ return currentPersonView;
+ }
+
+ /**
+ * Create menu that support cut/copy/paste.
+ */
+ private JMenuBar createMenuBar() {
+ JMenuItem menuItem;
+ JMenuBar menuBar = new JMenuBar();
+
+ JMenu fileMenu = new JMenu("File");
+
+ menuItem = new JMenuItem("Exit");
+ menuItem.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ System.exit(0);
+ }
+ });
+ fileMenu.add(menuItem);