1.

import javax.swing.*;
import java.awt.*;

public class Test {
	public static void main(String[] args) {
		JFrame fenetre = new JFrame();

		fenetre.setSize(500,500);
		fenetre.setLocation(100,100);
		fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		GridLayout layout = new GridLayout(4,1);
		fenetre.setLayout(layout);

		fenetre.add(new JRadioButton("Gryffondor"));
		fenetre.add(new JRadioButton("Serpentard"));
		fenetre.add(new JRadioButton("Serdaigle"));
		fenetre.add(new JRadioButton("Poufsouffle"));

		fenetre.setVisible(true);

	}
}

2.

import javax.swing.*;
import java.awt.*;

public class Test {
	public static void main(String[] args) {
		JFrame fenetre = new JFrame();
		int a = Integer.parseInt(args[0]);

		fenetre.setSize(500,500);
		fenetre.setLocation(100,100);
		fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		GridLayout layout = new GridLayout(a,a);
		fenetre.setLayout(layout);

		Color color_1 = Color.WHITE;
		Color color_2 = Color.CYAN;

		for (int j = 0; j < a; j++) {
			Color temp = color_1;
			color_1 = color_2;
			color_2 = temp;
			for(int i = 0; i < a; i++) {
				JPanel panneau = new JPanel();
				if (i%2 == 0) {
					panneau.setBackground(color_1);
				}
				else {
					panneau.setBackground(color_2);
				}
				fenetre.add(panneau);
			} 
		}



		fenetre.setVisible(true);

	}
}

3. 

