@Override
    public void paintComponent(Graphics g) {

        super.paintComponent(g);
        this.setBackground(Color.BLACK);

        l1.setText("Generation: " + lens.getLens().getNoGeneration());

        g.setColor(new Color(192, 0, 0));
        for (Ray r : lens.getRays()) {
            for (int i = 0; i < r.getMidPoints().size() - 1; ++i) {
//                logger.debug("draw ray " + i);
                g.drawLine(
                        (int) r.getMidPoints().get(i).getX() * View.SCALE + View.OFFSET_X,
                        (int) r.getMidPoints().get(i).getY() * View.SCALE + View.OFFSET_Y,
                        (int) r.getMidPoints().get(i + 1).getX() * View.SCALE + View.OFFSET_X,
                        (int) r.getMidPoints().get(i + 1).getY() * View.SCALE + View.OFFSET_Y
                );
            }
        }

        g.setColor(new Color(94, 255, 0));
        for (int i = 0; i < lens.getLeftSidePoints().size() - 1; i++) {
            Point p = lens.getLeftSidePoints().get(i);
            Point p2 = lens.getLeftSidePoints().get(i + 1);
            g.drawLine(
                    (int) p.getX() * View.SCALE + View.OFFSET_X,
                    (int) p.getY() * View.SCALE + View.OFFSET_Y,
                    (int) p2.getX() * View.SCALE + View.OFFSET_X,
                    (int) p2.getY() * View.SCALE + View.OFFSET_Y
            );
        }

        for (int i = 0; i < lens.getRightSidePoints().size() - 1; i++) {
            Point p = lens.getRightSidePoints().get(i);
            Point p2 = lens.getRightSidePoints().get(i + 1);
            g.drawLine(
                    (int) p.getX() * View.SCALE + View.OFFSET_X,
                    (int) p.getY() * View.SCALE + View.OFFSET_Y,
                    (int) p2.getX() * View.SCALE + View.OFFSET_X,
                    (int) p2.getY() * View.SCALE + View.OFFSET_Y
            );
        }
    }