diff --git a/DEV2.1/TP02/Boutons.class b/DEV2.1/TP02/Boutons.class index 0da8e56..d6f19ac 100644 Binary files a/DEV2.1/TP02/Boutons.class and b/DEV2.1/TP02/Boutons.class differ diff --git a/DEV2.1/TP02/Contingences.class b/DEV2.1/TP02/Contingences.class index 2b832f7..9a8db72 100644 Binary files a/DEV2.1/TP02/Contingences.class and b/DEV2.1/TP02/Contingences.class differ diff --git a/DEV2.1/TP02/Sirocco.class b/DEV2.1/TP02/Sirocco.class index fd3a8e8..7748cce 100644 Binary files a/DEV2.1/TP02/Sirocco.class and b/DEV2.1/TP02/Sirocco.class differ diff --git a/DEV2.1/TP02/Sirocco.java b/DEV2.1/TP02/Sirocco.java index 7c69203..6d68562 100644 --- a/DEV2.1/TP02/Sirocco.java +++ b/DEV2.1/TP02/Sirocco.java @@ -11,11 +11,11 @@ public class Sirocco { fenetre.setLocation(0, 0); fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // un composant pour afficher du texte - JLabel etiquette = new JLabel("Sirocco"); + JLabel etiquette = new JLabel("Nico a envoyé ses pieds ptn AAAAAAAH"); // on configure l'etiquette - etiquette.setHorizontalAlignment(JLabel.RIGHT); + etiquette.setHorizontalAlignment(JLabel.CENTER); // on ajoute le composant dans la fenetre, au milieu - fenetre.add(etiquette, BorderLayout.SOUTH); + fenetre.add(etiquette, BorderLayout.CENTER); // et on montre le resultat fenetre.setVisible(true); } diff --git a/DEV2.1/TP05/Nuance.java b/DEV2.1/TP05/Nuance.java new file mode 100644 index 0000000..3ac285e --- /dev/null +++ b/DEV2.1/TP05/Nuance.java @@ -0,0 +1,9 @@ +import java.awt.*; +import javax.swing.*; + +public class Nuance extends JPanel { + public Nuance() { + + super(); + } +} \ No newline at end of file diff --git a/DEV2.1/TP06/Formes.class b/DEV2.1/TP06/Formes.class new file mode 100644 index 0000000..a0da33c Binary files /dev/null and b/DEV2.1/TP06/Formes.class differ diff --git a/DEV2.1/TP06/Formes.java b/DEV2.1/TP06/Formes.java new file mode 100644 index 0000000..9a8f407 --- /dev/null +++ b/DEV2.1/TP06/Formes.java @@ -0,0 +1,47 @@ +import javax.swing.*; +import java.awt.*; + +public class Formes extends JComponent { + + private String typeComposant; + + public Formes(String typeComposant) { + super(); + this.typeComposant = typeComposant; + } + + @Override + protected void paintComponent(Graphics pinceau) { + // obligatoire : on crée un nouveau pinceau pour pouvoir le modifier plus tard + Graphics secondPinceau = pinceau.create(); + // obligatoire : si le composant n'est pas censé être transparent + if (this.isOpaque()) { + // obligatoire : on repeint toute la surface avec la couleur de fond + secondPinceau.setColor(this.getBackground()); + secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + + if (this.typeComposant == "Carre") { + secondPinceau.setColor(new Color(51,153,255)); + secondPinceau.fillRect(0, 0, 50, 50); + secondPinceau.setColor(Color.BLUE); + secondPinceau.drawRect(0,0,50,50); + } + + if (this.typeComposant == "Disque") { + // TODO + } + + } + + public static void main(String[] args) { + JFrame fenetre = new JFrame(); + Formes test = new Formes("Carre"); + // on configure la fenetre + fenetre.setSize(500, 500); + fenetre.setLocation(0, 0); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + fenetre.add(test); + fenetre.setVisible(true); + } +} \ No newline at end of file