| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 
 |  
import java.awt.*;
import java.awt.Image;
import java.awt.event.*;
import javax.swing.*;
import java.lang.Object;
 
public class Map extends JFrame {
	private int largeur;
	private int hauteur;
 
	public Map() {
		super("Carte");
		setSize(200, 200);
		ExitWindow exit = new ExitWindow();
		addWindowListener(exit);
	}
 
	public void Dimension(){
		setSize(largeur,hauteur);
	}
 
	public static void main(String[] arguments) {
		Map frame = new Map();
		Ecran calque=new Ecran();
		frame.largeur=600;
		frame.hauteur = 500;
		frame.Dimension();
		/*Brique map = new Brique();
		map.xpos=1;
		map.ypos=1;
		map.longueur=50;
		map.hauteur=10;
		frame.add(map);*/
		Niveau stage1 = new Niveau();
		stage1.Niveau(calque);
		/*Brique h=new Brique();
		h.xpos=206;
		h.ypos=56;
		h.longueur=63;
		h.hauteur=49;*/
		frame.add(calque);
		while(true){
			frame.repaint();
			frame.setVisible(true);
		}
 
		//brique b = new brique();
	}
 
}
class Niveau{
	int i=0;
	int j=0;
	int nbBrique=0;
	String[] tab = new String[6];
	Brique[] tabBrique= new Brique[18];
	Brique b = new Brique();
	public void Niveau(Ecran g){
 
		b.Brique(g);
 
		tab[0]="000111000";
		tab[1]="000111000";
		tab[2]="000111000";
		tab[3]="000111000";
		tab[4]="000111000";
		tab[5]="000111000";
		char c;
		for(i=0;i<5;i++){
			for(j=0;j<8;j++){
				c=tab[i].charAt(j);
				if(c=='1'){
					tabBrique[nbBrique]=b;					
					tabBrique[nbBrique].xpos=nbBrique*5;
					tabBrique[nbBrique].ypos=nbBrique*10;
					tabBrique[nbBrique].longueur=50;
					tabBrique[nbBrique].hauteur=10;
					System.out.println("num brique :" + nbBrique);
					System.out.println("xpos :" + tabBrique[nbBrique].xpos);
					System.out.println("ypos :" + tabBrique[nbBrique].ypos);
					//fenetre.add(tabBrique[nbBrique]);
					//fenetre.repaint();
					//tabBrique[nbBrique].repaint();
					nbBrique++;
 
					/*Brique b2 = new Brique();
 
					b2.xpos=200;
					b2.ypos=200;
					b2.longueur=50;
					b2.hauteur=60;
					fenetre.add(b2);*/	
				}
			}
		}
 
	}
}
 
class Raquette {
	public void dessinRaquette(){
 
	}
}
 
class Brique extends   {
	int xpos;
	int ypos;
	int longueur;
	int hauteur;
 
	public void Brique(Ecran t) {
                // le problème est ici il me dit qu'il ne trouve pas de method
                //drawRect
		t.drawRect(xpos,ypos,longueur,hauteur);
	}
}
 
class ExitWindow extends WindowAdapter {
	public void windowClosing(WindowEvent e) {
		System.exit(0);
	}
}
 
class Ecran extends JPanel{
	// a voir screengame.java
	public void paintComponent(Graphics comp) {
		Graphics2D comp2D = (Graphics2D)comp;
	}
} | 
Partager