update
This commit is contained in:
11
DEV.2.1/CM-blanc/CM-1/1.Duplication/Duplication.java
Normal file
11
DEV.2.1/CM-blanc/CM-1/1.Duplication/Duplication.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class Duplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
double[] tableau = new double[10];
|
||||||
|
|
||||||
|
Arrays.fill(tableau, 5.8);
|
||||||
|
|
||||||
|
System.out.println(Arrays.toString(tableau));
|
||||||
|
}
|
||||||
|
}
|
27
DEV.2.1/CM-blanc/CM-1/2.Morpion/Configuration.java
Normal file
27
DEV.2.1/CM-blanc/CM-1/2.Morpion/Configuration.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
public class Configuration {
|
||||||
|
|
||||||
|
private char[9] grille;
|
||||||
|
/*
|
||||||
|
On veut que chaque case soit un x ou un o et que si elle est vide alors n
|
||||||
|
la première case est 1 la deuxième 2, etc...
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Configuration() {
|
||||||
|
this.grille = {'n','n','n','n','n','n','n','n','n'};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int estLibre(int posGrille) {
|
||||||
|
if(this.grille[posGrille-1] == 'n') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void jouer(int position, char joueur) {
|
||||||
|
if(joueur == 'x') {
|
||||||
|
this.grille[position-1] = 'x';
|
||||||
|
} else if(joueur == 'o') {
|
||||||
|
this.grille[position-1] = 'o';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
0
DEV.2.1/CM-blanc/CM-1/2.Morpion/Main.java
Normal file
0
DEV.2.1/CM-blanc/CM-1/2.Morpion/Main.java
Normal file
@@ -3,14 +3,10 @@ import java.awt.*;
|
|||||||
|
|
||||||
public class Declinaisons extends JComponent {
|
public class Declinaisons extends JComponent {
|
||||||
|
|
||||||
private Color cyan = Color.CYAN;
|
public Declinaisons(String form, String fond) {
|
||||||
private Color pink = Color.PINK;
|
if(inst % 2 == 0) {
|
||||||
private Color magenta = Color.MAGENTA;
|
secondPinceau.setColor("")
|
||||||
private Color yellow = Color.YELLOW;
|
}
|
||||||
private Color blue = Color.BLUE;
|
|
||||||
|
|
||||||
public Declinaisons() {
|
|
||||||
super();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -21,10 +17,19 @@ public class Declinaisons extends JComponent {
|
|||||||
secondPinceau.setColor(this.getBackground());
|
secondPinceau.setColor(this.getBackground());
|
||||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
secondPinceau.setColor(this.getForeground());
|
secondPinceau.setColor(this.getForeground());
|
||||||
|
|
||||||
|
for(int i=0; i<10; i++){
|
||||||
|
if(this.num % 2 == 0){
|
||||||
|
this.num ++;
|
||||||
|
secondPinceau.setColor(Color.MAGENTA);
|
||||||
|
} else {
|
||||||
|
secondPinceau.setColor(Color.CYAN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int[] Xpoints = {this.getWidth()/4, this.getWidth()/4*3, this.getWidth()/2};
|
int[] Xpoints = {this.getWidth()/4, this.getWidth()/4*3, this.getWidth()/2};
|
||||||
int[] Ypoints = {this.getHeight()/2, this.getHeight()/4, this.getHeight()/4*3};
|
int[] Ypoints = {this.getHeight()/2, this.getHeight()/4, this.getHeight()/4*3};
|
||||||
secondPinceau.fillPolygon(Xpoints, Ypoints, 3);
|
secondPinceau.fillPolygon(Xpoints, Ypoints, 3);
|
||||||
|
@@ -9,8 +9,10 @@ public class Main {
|
|||||||
GridLayout tabl = new GridLayout(2,2);
|
GridLayout tabl = new GridLayout(2,2);
|
||||||
fenetre.setLayout(tabl);
|
fenetre.setLayout(tabl);
|
||||||
|
|
||||||
for(int i = 0; i < 4; i++)
|
for(int i = 0; i < 4; i++){
|
||||||
fenetre.add(new Declinaisons());
|
fenetre.add(new Declinaisons());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
BIN
DEV.2.1/cours-java/9.01 Exo.docx
Normal file
BIN
DEV.2.1/cours-java/9.01 Exo.docx
Normal file
Binary file not shown.
Reference in New Issue
Block a user