80 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			80 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| import java.awt.*;
 | |
| import javax.swing.*; 
 | |
| 
 | |
| public class Main {
 | |
| 	public static void main(String[] args) {
 | |
| 		Fenetre fenetre = new Fenetre();
 | |
| 
 | |
| 		fenetre.setVisible(true);
 | |
| 	}
 | |
| }
 | |
| 
 | |
| 
 | |
| /**
 | |
|  * 
 | |
|  */ 
 | |
| 
 | |
| public class Main {
 | |
|     public static void main(String[] args) {
 | |
|         FenetreDebut fenetredebut = new FenetreDebut();
 | |
|         fenetredebut.setVisible(true);
 | |
|     }
 | |
| }
 | |
| 
 | |
| 
 | |
| /**
 | |
|  * La classe <code>PaintFenetreDebut</code> 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);
 | |
| 
 | |
|     }
 | |
| 
 | |
| 
 | |
| } |