public void paintComponent(Graphics g) {
            synchronized (LiveSystemCopyMutex) {
                super.paintComponent(g);
                Graphics2D g2d = (Graphics2D) g;
                g2d.setColor(Color.black);
                g2d.fillRect(0, 0, panelWidth, panelHeight);
                List<Ship> ships = paintLS.ships;
                PlayerShip hero = paintLS.hero;
                List<Projectile> projectiles = paintLS.projectiles;
                ArrayList<Dust> dust = paintLS.dust;
                ArrayList<Star> stars = paintLS.stars;
                int thisSystemWidth = paintLS.thisSystemWidth;
                int thisSystemHeight = paintLS.thisSystemHeight;
                // Draw stars and dust.
                for (Star s : stars) {
                    g2d.setColor(s.color);
                    g2d.fillOval((int) (s.x + panelWidth / 2),
                        (int) (-(s.y) + panelHeight / 2), s.diam, s.diam);
                }
                for (Dust s : dust) {
                    g2d.setColor(s.color);
                    g2d.fillOval((int) (s.x + panelWidth / 2),
                        (int) (-(s.y) + panelHeight / 2), s.diam, s.diam);
                }
                // Draw ships and weapons.
                AffineTransform origXform;
                AffineTransform newXform;
                int xRot;
                int yRot;
                int frameX;
                int frameY;
                for (Ship s : ships) {
                    origXform = g2d.getTransform();
                    newXform = (AffineTransform)(origXform.clone());
                    // The center of rotation is the position of the object in
                    // the panel.
                    xRot = ((int) s.x) + panelWidth / 2;
                    yRot = -((int) s.y) + panelHeight / 2;
                    newXform.rotate(-s.angle, xRot, yRot);
                    g2d.setTransform(newXform);
                    // Position at which to draw in the panel.
                    frameX = ((int) s.x) + panelWidth / 2
                      - s.origObjImg.getWidth(this)/2;
                    frameY = -((int) s.y) + panelHeight / 2
                      - s.origObjImg.getHeight(this)/2;
                    // Draw rotated image.
                    g2d.drawImage(s.origObjImg, frameX, frameY, this);
                    g2d.setTransform(origXform);
                }
                for (Projectile w : projectiles) {
                    g2d.setColor(Color.yellow);
                    g2d.fillOval((int) (w.x + panelWidth / 2 - w.diam / 2),
                        (int) (-(w.y) + panelHeight / 2 - w.diam / 2),
                        w.diam, w.diam);
                }

                if (hero.status == ShipStatus.ALIVE) {

                    // Position at which to draw in the panel.
                    frameX = ((int) hero.x) + panelWidth / 2
                      - hero.spriteWidth/2;
                    frameY = -((int) hero.y) + panelHeight / 2
                      - hero.spriteHeight/2;
                    // Draw image.
                    g2d.drawImage(hero.sprite, frameX, frameY, this);
                } else if (hero.status == ShipStatus.DYING) {

                    origXform = g2d.getTransform();
                    newXform = (AffineTransform)(origXform.clone());
                    // The center of rotation is the position of the hero in
                    // the panel.
                    xRot = ((int) hero.x) + panelWidth/2;
                    yRot = -((int) hero.y) + panelHeight/2;
                    newXform.rotate(-hero.angle, xRot, yRot);
                    g2d.setTransform(newXform);
                    // Position at which to draw in the panel.
                    frameX = ((int) hero.x) + panelWidth / 2
                      - hero.origObjImg.getWidth(this)/2;
                    frameY = -((int) hero.y) + panelHeight / 2
                      - hero.origObjImg.getHeight(this)/2;
                    // Draw rotated image.
                    g2d.drawImage(hero.origObjImg, frameX, frameY, this);
                    g2d.setTransform(origXform);
                }

                // Paint sidebar.
                g2d.setColor(Color.black);
                g2d.fillRect(panelWidth, 0, sideMenuWidth, panelHeight);
                g2d.setColor(new Color(0xFF808080));
                g2d.fillRect(panelWidth, 0, hudDividerWidth, panelHeight);

                // Paint minimap.
                g2d.setColor(Color.red);
                g2d.drawRect(panelWidth + hudDividerWidth + mapMargin - 1,
                    mapMargin - 1, mapWidth + 2, mapWidth + 2);

                for (Ship s : ships) {
                    // This if statement is extra for later.
                    // if (s.isHostile)
                    g2d.setColor(Color.red);
                    // else
                    // g2d.setColor(Color.green);
                    g2d.fillOval(((int) (s.x * (double) mapWidth / (double) thisSystemWidth) + (mapWidth / 2) + panelWidth + mapMargin + hudDividerWidth) - 1,
                        -((int) (s.y * (double) mapWidth / (double) thisSystemHeight)) + (mapWidth / 2) + mapMargin - 1,
                        3, 3);
                }
                g2d.setColor(Color.blue);
                g2d.fillOval((int) (hero.x * (double) mapWidth / (double) thisSystemWidth) + (mapWidth / 2) + panelWidth + mapMargin + hudDividerWidth - 1,
                    -((int) (hero.y * (double) mapWidth / (double) thisSystemHeight)) + (mapWidth / 2) + mapMargin - 1,
                    3, 3);
                // Paint rectangle around visible field on minimap.
                g2d.setColor(new Color(0x00C000));
                g2d.drawRect((int) ((-panelWidth / 2) * (double) mapWidth / (double) thisSystemWidth) + (mapWidth / 2) + panelWidth + mapMargin + hudDividerWidth, -((int) ((panelHeight / 2) * (double) mapWidth / (double) thisSystemHeight)) + (mapWidth / 2) + mapMargin, (int) (panelWidth * (double) mapWidth / (double) thisSystemWidth), (int) (panelHeight * (double) mapWidth / (double) thisSystemHeight));

                // Paint health bar.
                g2d.setColor(new Color(0x3D75B8));
                g2d.fillRect(panelWidth + hudDividerWidth + mapMargin - 1,
                    mapMargin + mapWidth + 5,
                    (mapWidth + 3) * hero.structInteg / hero.maxStructInteg,
                    20);
            }
        }