public SimulationMenu(final Simulation model, final MainWindow mainWindow) {
        super(new BorderLayout());

        setOpaque(false);

        this.model = model;// Assigns the model that this menu will control.
        this.mainWindow = mainWindow;// Assigns the window this is related to.

        // Get the resources (pictures for the buttons):
        stepIcon = new ImageIcon(getClass().getResource(STEP_IMAGE_LOCATION));
        playIcon = new ImageIcon(getClass().getResource(PLAY_IMAGE_LOCATION));
        stopIcon = new ImageIcon(getClass().getResource(STOP_IMAGE_LOCATION));

        // The step / play / pause menu:
        playMenuHolder = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 2));

        playMenu = new JPanel(null);
        playMenu.setPreferredSize(new Dimension(125, 25));
        playMenu.setBorder(BorderFactory.createTitledBorder(""));
        playMenu.setOpaque(false);

        step = new JButton(stepIcon);
        step.setBounds(25, 3, 20, 20);
        step.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                stepModel();
            }
        });
        playMenu.add(step);

        play = new JButton(playIcon) {
            {
                setIcon(playIcon);
            }

            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);

                if (SimulationMenu.this.model.isPlaying()) {
                    Graphics2D g2d = (Graphics2D) g;
                    Rectangle toPaint = new Rectangle(2, 2, getWidth() - 4,
                            getHeight() - 4);
                    g2d.setColor(new Color(0x33, 0x66, 0x99, 0x66));
                    g2d.fill(toPaint);
                }
            }
        };
        play.setBounds(50, 3, 20, 20);
        play.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                play();
            }
        });
        playMenu.add(play);

        stop = new JButton(stopIcon);
        stop.setBounds(75, 3, 20, 20);
        stop.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                stop();
            }
        });
        playMenu.add(stop);

        playMenuHolder.add(playMenu);
        add(playMenuHolder, BorderLayout.NORTH);

        // The tabbed pane and everything in it:

        menuPane = new JTabbedPane();
        menuPane.setPreferredSize(new Dimension(150, 500));

        optionsMenu = new WatermarkedPanel(new FlowLayout(FlowLayout.CENTER, 0,
                10));

        // The speed control:
        speedMenu = new JPanel();
        speedMenu.setPreferredSize(new Dimension(125, 50));
        speedMenu.setBorder(BorderFactory.createTitledBorder("Framerate"));
        speedMenu.setOpaque(false);

        speedSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 100,
                (int) speed);
        speedSlider.setPreferredSize(new Dimension(100, 20));
        speedSlider.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                setSpeed(speedSlider.getValue());
            }
        });
        speedSlider.setOpaque(false);
        speedMenu.add(speedSlider);

        // The accuracy control:
        accuracyMenu = new JPanel();
        accuracyMenu.setPreferredSize(new Dimension(125, 50));
        accuracyMenu.setBorder(BorderFactory.createTitledBorder("Accuracy"));
        accuracyMenu.setOpaque(false);

        accuracySlider = new JSlider(SwingConstants.HORIZONTAL, 0, 10,
                getAccuracy());
        accuracySlider.setPreferredSize(new Dimension(100, 20));
        accuracySlider.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                setAccuracy(accuracySlider.getValue());
            }
        });
        accuracySlider.setOpaque(false);
        accuracyMenu.add(accuracySlider);

        gravityMenu = new JPanel();
        gravityMenu.setPreferredSize(new Dimension(125, 60));
        gravityMenu.setBorder(BorderFactory.createTitledBorder("Gravity"));
        gravityMenu.setOpaque(false);

        gravitySlider = new JSlider(SwingConstants.HORIZONTAL, -5, 5,
                (int) model.getGravity());
        gravitySlider.setPreferredSize(new Dimension(100, 30));
        gravitySlider.setPaintTicks(true);
        gravitySlider.setMajorTickSpacing(5);
        gravitySlider.setMinorTickSpacing(1);
        gravitySlider.setSnapToTicks(true);
        gravitySlider.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                model.setGravity(gravitySlider.getValue());
            }
        });
        gravitySlider.setOpaque(false);
        gravityMenu.add(gravitySlider);

        // Update the gravitySlider properly:
        model.addPhysicsListener(new PhysicsListener() {
            @Override
            public void stateChanged(PhysicsEvent e) {
                if (model.getGravity() != gravitySlider.getValue()) {
                    if (model.getGravity() < gravitySlider.getMinimum()) {
                        model.setGravity(gravitySlider.getMinimum());
                        gravitySlider.setValue(gravitySlider.getMinimum());
                    } else if (model.getGravity() > gravitySlider.getMaximum()) {
                        model.setGravity(gravitySlider.getMaximum());
                        gravitySlider.setValue(gravitySlider.getMaximum());
                    } else {
                        gravitySlider.setValue((int) model.getGravity());
                    }
                }
                setGoing(false);
            }
        });

        optionsMenu.add(speedMenu);
        optionsMenu.add(accuracyMenu);
        optionsMenu.add(gravityMenu);

        menuPane.addTab("Options", optionsMenu);

        cameraMenu = new WatermarkedPanel();

        mapPanel = new JPanel(new BorderLayout());
        mapPanel.setOpaque(false);
        mapPanel.setPreferredSize(new Dimension(120, 120));
        mapPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));

        map = new CameraMap(model, this.mainWindow.modelView);
        mapPanel.add(map, BorderLayout.CENTER);

        cameraMenu.add(mapPanel);

        zoomPanel = new JPanel();
        zoomPanel.setPreferredSize(new Dimension(125, 50));
        zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom"));
        zoomPanel.setOpaque(false);

        zoomSlider = new JSlider(-1000, 1000, 0);
        zoomSlider.setPreferredSize(new Dimension(100, 20));
        zoomSlider.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                double zoomFactor = 1.0;

                double value;

                if (zoomSlider.getValue() >= 0) {
                    value = ((double) zoomSlider.getValue()) / 1000;
                    value *= 2;
                } else {
                    value = ((double) zoomSlider.getValue()) / 1200;
                }
                zoomFactor = 1.01 + value;

                mainWindow.modelView.setZoomFactor(zoomFactor);
            }
        });
        zoomSlider.setOpaque(false);
        zoomPanel.add(zoomSlider);

        cameraMenu.add(zoomPanel);

        menuPane.addTab("Camera", cameraMenu);

        add(menuPane);

        setPreferredSize(new Dimension(160, 650));

    }