22 lines
831 B
Java
22 lines
831 B
Java
import java.awt.*;
|
|
import javax.swing.*;
|
|
|
|
public class DeclinaisonsMain {
|
|
public static void main(String[] args) {
|
|
JFrame fenetre = new JFrame();
|
|
fenetre.setSize(300, 300);
|
|
fenetre.setLocation(100, 100);
|
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
fenetre.setLayout(new GridLayout(2, 2));
|
|
JPanel[] panneaux = {new JPanel(), new JPanel(), new JPanel(), new JPanel()};
|
|
Color[] couleursTriangles = {Color.MAGENTA, Color.YELLOW, Color.CYAN, Color.BLUE};
|
|
Color[] couleursFonds = {Color.CYAN, Color.PINK, Color.MAGENTA, Color.YELLOW};
|
|
for (int i = 0; i != 4; i++) {
|
|
panneaux[i].setBackground(couleursFonds[i]);
|
|
panneaux[i].setLayout(new BorderLayout());
|
|
panneaux[i].add(new Declinaisons(couleursTriangles[i]), BorderLayout.CENTER);
|
|
fenetre.add(panneaux[i]);
|
|
}
|
|
fenetre.setVisible(true);
|
|
}
|
|
} |