diff --git a/DEV.2.1/CM-blanc/CM-1/Main.java b/DEV.2.1/CM-blanc/CM-1/Main.java index d2faa22..8bb006e 100644 --- a/DEV.2.1/CM-blanc/CM-1/Main.java +++ b/DEV.2.1/CM-blanc/CM-1/Main.java @@ -7,4 +7,74 @@ public class Main { fenetre.setVisible(true); } +} + + +/** + * + */ + +public class Main { + public static void main(String[] args) { + FenetreDebut fenetredebut = new FenetreDebut(); + fenetredebut.setVisible(true); + } +} + + +/** + * La classe PaintFenetreDebut est utilisée pour dessiner et faire apparaître l'image de menu sur + * la fenêtre de début de jeu. + * + * @version 1.2 + * @author Emmanuel SRIVASTAVA-TIAMZON + */ + +import javax.swing.*; +import java.awt.*; + +public class PaintFenetreDebut extends JComponent { + + private Image MenuDebut; + + public PaintFenetreDebut() { + this.MenuDebut = Toolkit.getDefaultToolkit().getImage("../image/MenuDebut.jpg"); + + } + + @Override + public void paintComponent(Graphics pinceau) { + Graphics secondPinceau = pinceau.create(); + + if (this.isOpaque()) { + secondPinceau.setColor(this.getBackground()); + secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight()); + } + + secondPinceau.drawImage(this.MenuDebut, this.getWidth(), this.getHeight(), this); + + } +} + + + +import javax.swing.*; +import java.awt.*; + +public class FenetreDebut extends JFrame { + public FenetreDebut() { + super("SameGame"); + this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + this.setSize(765, 510); + this.setLocation(this.getWidth()/2 - 100 ,this.getHeight()/2 - 100); + + JPanel imagePanel = new JPanel(); + imagePanel.setLayout(new GridLayout(1,1)); + + PaintFenetreDebut paintfenetredebut = new PaintFenetreDebut(); + this.add(paintfenetredebut); + + } + + } \ No newline at end of file