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

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

        final JCheckBoxMenuItem animate = new JCheckBoxMenuItem("Animate");
        animate.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                grid.setAnimating(animate.getState());
            }
        });

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

        final JCheckBoxMenuItem verySlow = new JCheckBoxMenuItem("Very Slow");
        final JCheckBoxMenuItem slow = new JCheckBoxMenuItem("Slow");
        final JCheckBoxMenuItem fast = new JCheckBoxMenuItem("Fast");
        fast.setState(true);
        final JCheckBoxMenuItem veryFast = new JCheckBoxMenuItem("Very Fast");

        final JMenuItem reset = new JMenuItem("Reset");
        reset.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                if (grid.isAnimating())
                    return;
                grid.reset();
            }
        });

        verySlow.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                reset(slow, fast, veryFast);
                grid.setSpeed(Speed.VERY_SLOW);
            }
        });
        slow.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                reset(verySlow, fast, veryFast);
                grid.setSpeed(Speed.SLOW);
            }
        });
        fast.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                reset(verySlow, slow, veryFast);
                grid.setSpeed(Speed.FAST);
            }
        });
        veryFast.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                reset(verySlow, slow, fast);
                grid.setSpeed(Speed.VERY_FAST);
            }
        });

        file.add(animate);
        file.addSeparator();
        file.add(reset);
        file.add(exit);

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

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

        setJMenuBar(jMenuBar);
    }