diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/DeviseInfoPrinter.class b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/DeviseInfoPrinter.class new file mode 100644 index 0000000..57d97b3 Binary files /dev/null and b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/DeviseInfoPrinter.class differ diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Monnaie.class b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Monnaie.class index a11dce7..742cff2 100644 Binary files a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Monnaie.class and b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Monnaie.class differ diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Monnaie.java b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Monnaie.java index a1496a3..aeb66dd 100644 --- a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Monnaie.java +++ b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Monnaie.java @@ -1,16 +1,22 @@ -import java.lang.Object; import java.util.Currency; -public class Monnaie{ - public static void main(String args[]){ - if(args.length > 0){ +public class Monnaie { + public static void main(String args[]) { + DeviseInfoPrinter deviseInfoPrinter = new DeviseInfoPrinter(); + + if (args.length > 0) { String nom_monnaie = args[0]; - Currency monnaie = Currency.getInstance(nom_monnaie); - System.out.println("Code numerique : "+monnaie.getNumericCode()); - System.out.println("Symbole : "+ monnaie.getSymbol()); - }else{ + deviseInfoPrinter.printDeviseInfo(nom_monnaie); + } else { System.out.println("Merci d'indiquer une valeur EX : \"EUR\""); } - } -} \ No newline at end of file +} + +class DeviseInfoPrinter { + public void printDeviseInfo(String nom_monnaie) { + Currency monnaie = Currency.getInstance(nom_monnaie); + System.out.println("Code numerique : " + monnaie.getNumericCode()); + System.out.println("Symbole : " + monnaie.getSymbol()); + } +} diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Sudoku/Menu.class b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO2/Sudoku/Menu.class similarity index 100% rename from BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Sudoku/Menu.class rename to BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO2/Sudoku/Menu.class diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Sudoku/Nuance.java b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO2/Sudoku/Nuance.java similarity index 100% rename from BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO1/Sudoku/Nuance.java rename to BUT1/CONTROLE/DEV2.1/Entrainement/SUJETA/EXO2/Sudoku/Nuance.java diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/Ciel.class b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/Ciel.class new file mode 100644 index 0000000..187804e Binary files /dev/null and b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/Ciel.class differ diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/Ciel.java b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/Ciel.java new file mode 100644 index 0000000..f200e8a --- /dev/null +++ b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/Ciel.java @@ -0,0 +1,40 @@ +import javax.swing.JComponent; +import java.awt.Graphics; + +public class Ciel extends JComponent { + @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()); + } + // maintenant on dessine ce que l'on veut + secondPinceau.setColor(this.getForeground()); + secondPinceau.drawString("Bonjour !", 10, 20); + } + + + public static void main(String[] args) { + SwingUtilities.invokeLater(() -> { + createAndShowGUI(); + }); + } + + private static void createAndShowGUI() { + JFrame fenetre = new JFrame("Ciel Bleu"); + fenetre.setSize(400, 400); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + // Ajout de votre composant Ciel dans la fenêtre + Ciel cielComponent = new Ciel(); + fenetre.add(cielComponent); + + // Assurez-vous que la fenêtre est visible + fenetre.setVisible(true); + } + +} \ No newline at end of file diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/Soleil.java b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/Soleil.java new file mode 100644 index 0000000..27063dd --- /dev/null +++ b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/Soleil.java @@ -0,0 +1,9 @@ +import javax.swing.JComponent; +import java.awt.Graphics; + +public class Soleil{ + + public Soleil(){ + + } +} \ No newline at end of file diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/Explication.txt b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/Explication.txt new file mode 100644 index 0000000..e40fa09 --- /dev/null +++ b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/Explication.txt @@ -0,0 +1,3 @@ +Main.java, SkyFrame.java et SunPanel.java on été générer par ChatGPT. + +Le code n'est pas forcément bon, c'est juste pour voir comment faire \ No newline at end of file diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/Main.java b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/Main.java new file mode 100644 index 0000000..f487001 --- /dev/null +++ b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/Main.java @@ -0,0 +1,12 @@ +import javax.swing.*; + +public class Main { + public static void main(String[] args) { + SwingUtilities.invokeLater(() -> { + SkyFrame skyFrame = new SkyFrame(); + skyFrame.setSize(800, 600); + skyFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + skyFrame.setVisible(true); + }); + } +} diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/SkyFrame.java b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/SkyFrame.java new file mode 100644 index 0000000..b09a3ff --- /dev/null +++ b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/SkyFrame.java @@ -0,0 +1,22 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +public class SkyFrame extends JFrame { + private SunPanel sunPanel; + + public SkyFrame() { + setTitle("Sky with Sun"); + setLayout(new BorderLayout()); + + sunPanel = new SunPanel(); + add(sunPanel, BorderLayout.CENTER); + + addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + sunPanel.increaseSunRadius(15); + } + }); + } +} diff --git a/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/SunPanel.java b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/SunPanel.java new file mode 100644 index 0000000..b74f54f --- /dev/null +++ b/BUT1/CONTROLE/DEV2.1/Entrainement/SUJETB/EXO4/SolutiondeGPT/SunPanel.java @@ -0,0 +1,38 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class SunPanel extends JPanel { + private int sunRadius; + + public SunPanel() { + sunRadius = 50; // Rayon initial du soleil + addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + increaseSunRadius(15); + } + }); + } + + public void increaseSunRadius(int increment) { + sunRadius += increment; + repaint(); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + + Graphics2D g2d = (Graphics2D) g; + g2d.setColor(new Color(115, 194, 251)); // Couleur du ciel + g2d.fillRect(0, 0, getWidth(), getHeight()); + + int sunX = getWidth() / 2 - sunRadius; + int sunY = getHeight() - sunRadius * 2; + + g2d.setColor(Color.YELLOW); // Couleur du soleil + g2d.fillOval(sunX, sunY, sunRadius * 2, sunRadius * 2); + } +}