diff --git a/DEV2.1/TP5:MiseEnPageEtDessin/Damier.class b/DEV2.1/TP5:MiseEnPageEtDessin/Damier.class new file mode 100644 index 0000000..dad1a54 Binary files /dev/null and b/DEV2.1/TP5:MiseEnPageEtDessin/Damier.class differ diff --git a/DEV2.1/TP5:MiseEnPageEtDessin/Damier.java b/DEV2.1/TP5:MiseEnPageEtDessin/Damier.java new file mode 100644 index 0000000..780cce5 --- /dev/null +++ b/DEV2.1/TP5:MiseEnPageEtDessin/Damier.java @@ -0,0 +1,20 @@ +import javax.swing.*; +import java.awt.*; + +public class Damier{ + + public static void main(String[] args) { + JFrame fenetre = new JFrame(); + fenetre.setSize(400, 400); + fenetre.setLocation(0, 0); + GridLayout grille = new GridLayout(5,5); + fenetre.setLayout(grille); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + for (int i=0; i < 25; ++i){ + JPanel panel = new JPanel(); + panel.setBackground(i%2 == 0 ? Color.WHITE : Color.CYAN); + fenetre.add(panel); + } fenetre.setVisible(true); + } +} \ No newline at end of file diff --git a/DEV2.1/TP5:MiseEnPageEtDessin/Sautoir.java b/DEV2.1/TP5:MiseEnPageEtDessin/Sautoir.java new file mode 100644 index 0000000..13ce3b2 --- /dev/null +++ b/DEV2.1/TP5:MiseEnPageEtDessin/Sautoir.java @@ -0,0 +1,10 @@ +import javax.swing.*; +import java.awt.*; + +public class Sautoir extends JComponent{ + + protected void paintComponent(Graphics pinceau) { + // obligatoire : on crée un nouveau pinceau pour pouvoir le modifier plus tard + Graphics pinceau = pinceau.create(); + pinceau.setColor(Color.CYAN); + pinceau.fillPolygon([0,0],[50,0],3); \ No newline at end of file