TP
This commit is contained in:
22
DEV2.1/controle_machine_1/DeclinaisonsMain.java
Normal file
22
DEV2.1/controle_machine_1/DeclinaisonsMain.java
Normal file
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user