package edu.drexel.cs451_rbbtd.apologies.gui;

import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.util.ArrayList;


public class Apologies extends JFrame {
    public static ArrayList<JTextField> names = new ArrayList<JTextField>();

    public Apologies(ArrayList<PlayerColor> playerColors, PlayerColor first, ArrayList<JTextField> pNames) {
        names = pNames;
        // initialize art assets
        String boardIMG = getResourcePath("ApologiesBoard.png");
        //String boardIMG = "resources/ApologiesBoard.png";
        Image board = new ImageIcon(boardIMG).getImage();

        add(new Board(board, playerColors, first));
        setTitle("Apologies");
        setSize(600, 675);
        setResizable(false);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        setVisible(true);
    }

    public static String getResourcePath(String resourceFilename) {
        return "src" + File.separator + "main" + File.separator + "resources" + File.separator + resourceFilename;
    }

    public static String getNames(int i) { return names.get(i).getText(); }

    public static void swapFirstLast() {
        JTextField nextName = names.get(0);
        names.remove(nextName);
        names.add(nextName);
    }
} // end class


@@ -77,24 +77,97 @@
 java.awt.*;%0A
+import java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;%0A
 import java.
@@ -175,16 +175,16 @@
 o.File;%0A
-
 import j
@@ -321,16 +321,70 @@
 ield%3E();
+%0A    private JMenuBar menuBar;%0A    private JMenu menu;
 %0A%0A    pu
@@ -608,24 +608,26 @@
 .png%22);%0A
+//
         
 //String
@@ -618,18 +618,16 @@
         
-//
 String b
@@ -726,17 +726,37 @@
 mage();%0A
+        setupMenu();
 %0A
-
         
@@ -1426,22 +1426,423 @@
 tName);%0A
-
     %7D%0A
+%0A    private void setupMenu() %7B%0A        menuBar = new JMenuBar();%0A        menu = new JMenu(%22Game%22);%0A        JMenuItem quit = new JMenuItem(%22Quit%22);%0A        quit.addActionListener(new ActionListener() %7B%0A            public void actionPerformed(ActionEvent e) %7B%0A                dispose();%0A            %7D%0A        %7D);%0A        menu.add(quit);%0A        menuBar.add(menu);%0A        setJMenuBar(menuBar);%0A%0A    %7D%0A%0A
 %7D // end

Add "Game" menu to the game board screen with "Quit" menu item