private void generateJMenuBar() {
        JMenuBar jMenuBar = new JMenuBar();

        JMenu file = new JMenu("File");
        JMenu calculate = new JMenu("Calculate");
        JMenu speed = new JMenu("Speed");

        JMenuItem resetGrid = new JMenuItem("Reset Grid");
        resetGrid.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                grid.reset();
            }
        });

        JMenuItem exit = new JMenuItem("Exit");
        exit.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                System.exit(0);
            }
        });

        JMenuItem manhattan = new JMenuItem("Manhattan");
        manhattan.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                calculateManhattan();
            }
        });

        JMenuItem euclidean = new JMenuItem("Euclidean");
        euclidean.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                calculateEuclidean();
            }
        });

        final JCheckBoxMenuItem realtime = new JCheckBoxMenuItem("Realtime");
        final JCheckBoxMenuItem veryFast = new JCheckBoxMenuItem("Very Fast");
        final JCheckBoxMenuItem fast = new JCheckBoxMenuItem("Fast");
        final JCheckBoxMenuItem slow = new JCheckBoxMenuItem("Slow");
        final JCheckBoxMenuItem verySlow = new JCheckBoxMenuItem("Very Slow");
        realtime.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setSpeed(Speed.REALTIME);
                if (!realtime.getState()) {
                    realtime.setState(true);
                }
                disableCheckBoxMenuItems(veryFast, fast, slow, verySlow);
            }
        });
        veryFast.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setSpeed(Speed.VERY_FAST);
                if (!veryFast.getState()) {
                    veryFast.setState(true);
                }
                disableCheckBoxMenuItems(realtime, fast, slow, verySlow);
            }
        });
        fast.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setSpeed(Speed.FAST);
                if (!fast.getState()) {
                    fast.setState(true);
                }
                disableCheckBoxMenuItems(realtime, veryFast, slow, verySlow);
            }
        });
        slow.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setSpeed(Speed.SLOW);
                if (!slow.getState()) {
                    slow.setState(true);
                }
                disableCheckBoxMenuItems(realtime, veryFast, fast, verySlow);
            }
        });
        verySlow.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                setSpeed(Speed.VERY_SLOW);
                if (!verySlow.getState()) {
                    verySlow.setState(true);
                }
                disableCheckBoxMenuItems(realtime, veryFast, fast, slow);
            }
        });

        slow.setState(true);

        file.add(resetGrid);
        file.add(exit);

        calculate.add(manhattan);
        calculate.add(euclidean);

        speed.add(realtime);
        speed.add(veryFast);
        speed.add(fast);
        speed.add(slow);
        speed.add(verySlow);

        jMenuBar.add(file);
        jMenuBar.add(calculate);
        jMenuBar.add(speed);

        setJMenuBar(jMenuBar);
    }