diff --git a/DEV2.1/TP05/Nuance.class b/DEV2.1/TP05/Nuance.class new file mode 100644 index 0000000..6aac217 Binary files /dev/null and b/DEV2.1/TP05/Nuance.class differ diff --git a/DEV2.1/TP05/Nuance.java b/DEV2.1/TP05/Nuance.java index 3ac285e..40e8377 100644 --- a/DEV2.1/TP05/Nuance.java +++ b/DEV2.1/TP05/Nuance.java @@ -2,8 +2,50 @@ import java.awt.*; import javax.swing.*; public class Nuance extends JPanel { - public Nuance() { - + private int r; + private int g; + private int b; + + public Nuance(int[] couleurs) { super(); + this.r = couleurs[0]; + this.g = couleurs[1]; + this.b = couleurs[2]; + this.setPreferredSize(new Dimension(100,100)); + this.afficheNuance(); } + + public void afficheNuance() { + this.setBackground(new Color(this.r, this.g, this.b)); + BorderLayout layout = new BorderLayout(); + this.setLayout(layout); + JLabel texte_superieur = new JLabel(this.r + "," + this.g + "," + this.b); + texte_superieur.setHorizontalAlignment(JLabel.CENTER); + texte_superieur.setOpaque(true); + texte_superieur.setForeground(Color.WHITE); + texte_superieur.setBackground(Color.BLACK); + this.add(texte_superieur, BorderLayout.NORTH); + } + + public static void main(String[] args) { + JFrame fenetre = new JFrame(); + fenetre.setLocation(100,100); + fenetre.setLayout(new FlowLayout()); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + for (String element : args) { + element = element.replaceAll("#", ""); + int[] couleurs = { + Integer.parseInt(element.substring(0,2), 16), + Integer.parseInt(element.substring(2,4), 16), + Integer.parseInt(element.substring(4,6), 16) + }; + fenetre.add(new Nuance(couleurs)); + } + + fenetre.pack(); + fenetre.setVisible(true); + } + + } \ No newline at end of file diff --git a/DEV2.1/TP06/GFG.class b/DEV2.1/TP06/GFG.class deleted file mode 100644 index c1fa487..0000000 Binary files a/DEV2.1/TP06/GFG.class and /dev/null differ diff --git a/DEV2.1/TP06/Main.java b/DEV2.1/TP06/Main.java deleted file mode 100644 index 1244737..0000000 --- a/DEV2.1/TP06/Main.java +++ /dev/null @@ -1,12 +0,0 @@ -public class Main { - public static void main(String[] args) { - JFrame fenetre = new JFrame(); - Sautoir test = new Sautoir(); - // 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 diff --git a/DEV2.1/TP06/Sautoir.class b/DEV2.1/TP06/Sautoir.class index 937cc65..4259a53 100644 Binary files a/DEV2.1/TP06/Sautoir.class and b/DEV2.1/TP06/Sautoir.class differ