import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class Principle extends JFrame{

	List<Couleur> colors = new ArrayList<Couleur>();
	private JPanel panel;
	
	public Principle() {
		
		panel = new JPanel();
		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
		
		colors.add(new Couleur());
		
		setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
		JButton b = new JButton("Ajouter une couleur");
		b.setAlignmentX(Component.CENTER_ALIGNMENT);
		
		b.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				colors.add(new Couleur());
				for(Couleur c : colors){
					panel.add(c);
				}
				validate();
				repaint();
			}
		});
		
		panel.add(b);
		panel.add(new Couleur());
		add(panel);

		setSize(new Dimension(1000,500));
		setTitle("Color setter");
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		double width = screenSize.getWidth();
		double height = screenSize.getHeight();
		setLocation((int) ((width/2 - this.getWidth()/2)), (int) (height/2 - this.getHeight()/2));
		setVisible(true);
		
	}
}

@@ -354,58 +354,8 @@
 e%7B%0A%0A
-%09List%3CCouleur%3E colors = new ArrayList%3CCouleur%3E();%0A
 %09pri
@@ -373,16 +373,16 @@
  panel;%0A
+
 %09%0A%09publi
@@ -489,38 +489,8 @@
 ;%0A%09%09
-%0A%09%09colors.add(new Couleur());%0A
 %09%09%0A%09
@@ -770,22 +770,21 @@
 ) %7B%0A%09%09%09%09
-colors
+panel
 .add(new
@@ -800,62 +800,8 @@
 ));%0A
-%09%09%09%09for(Couleur c : colors)%7B%0A%09%09%09%09%09panel.add(c);%0A%09%09%09%09%7D%0A
 %09%09%09%09

remove arraylist