Java, um farbige Linien zu laufen

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

        Graphics2D g2d = (Graphics2D) g.create();
        g2d.setColor(Color.RED); //Lines' Color is set here
        g2d.setStroke(new BasicStroke(3));

        for(List<JLabel> line : lines) {

            for(int i=0; i <(line.size()) ; i++) {
                JLabel label1 = line.get(i);
                int n = (i == (line.size()-1)) ? 0: i+1;
                JLabel label2 = line.get(n);
                g2d.draw(new Line2D.Float(getCenter(label1), getCenter(label2)));
            }
        }

        g2d.dispose();
    }
dhiraj sl