flut d'octet
This commit is contained in:
BIN
DEV2.1/CM1/Configuration.class
Normal file
BIN
DEV2.1/CM1/Configuration.class
Normal file
Binary file not shown.
23
DEV2.1/CM1/Configuration.java
Normal file
23
DEV2.1/CM1/Configuration.java
Normal file
@@ -0,0 +1,23 @@
|
||||
public class Configuration{
|
||||
private int[][] morpion;
|
||||
|
||||
public Configuration(){
|
||||
this.morpion = new int[][] {{0,0,0},{0,0,0},{0,0,0}};
|
||||
}
|
||||
|
||||
public boolean EstLibre(int position){
|
||||
int ligne = position/3;
|
||||
int colonne = position%3;
|
||||
if (this.morpion[ligne][colonne] == 0){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// joueur peut être soit 1(= la croix) ou 2(= le rond) pour l'ordre de jeux//
|
||||
public void Jouer(int position, int joueur){
|
||||
int ligne = position/3;
|
||||
int colonne = position%3;
|
||||
this.morpion[ligne][colonne] = joueur;
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/CM1/Declinaisons.class
Normal file
BIN
DEV2.1/CM1/Declinaisons.class
Normal file
Binary file not shown.
23
DEV2.1/CM1/Declinaisons.java
Normal file
23
DEV2.1/CM1/Declinaisons.java
Normal file
@@ -0,0 +1,23 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
|
||||
public class Declinaisons {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 500);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
GridLayout gestionnaire = new GridLayout(2, 2);
|
||||
gestionnaire.setVgap(-15);
|
||||
fenetre.setLayout(gestionnaire);
|
||||
Partie part1 = new Partie(Color.CYAN,Color.MAGENTA);
|
||||
fenetre.add(part1);
|
||||
Partie part2 = new Partie(Color.MAGENTA,Color.CYAN);
|
||||
fenetre.add(part2);
|
||||
Partie part3 = new Partie(Color.PINK,Color.YELLOW);
|
||||
fenetre.add(part3);
|
||||
Partie part4 = new Partie(Color.YELLOW,Color.BLUE);
|
||||
fenetre.add(part4);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/CM1/Duplication.class
Normal file
BIN
DEV2.1/CM1/Duplication.class
Normal file
Binary file not shown.
21
DEV2.1/CM1/Duplication.java
Normal file
21
DEV2.1/CM1/Duplication.java
Normal file
@@ -0,0 +1,21 @@
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Duplication{
|
||||
private double[] tab;
|
||||
|
||||
public Duplication(){
|
||||
this.tab = new double[10];
|
||||
Arrays.fill(this.tab,5.8);
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
System.out.print(Arrays.toString(this.tab));
|
||||
System.out.println();
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void main (String[] args){
|
||||
Duplication tab = new Duplication();
|
||||
tab.toString();
|
||||
}
|
||||
}
|
||||
BIN
DEV2.1/CM1/Partie.class
Normal file
BIN
DEV2.1/CM1/Partie.class
Normal file
Binary file not shown.
26
DEV2.1/CM1/Partie.java
Normal file
26
DEV2.1/CM1/Partie.java
Normal file
@@ -0,0 +1,26 @@
|
||||
import javax.swing.JComponent;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Color;
|
||||
|
||||
public class Partie extends JComponent {
|
||||
private Color fond;
|
||||
private Color triangle;
|
||||
|
||||
public Partie(Color fond, Color triangle){
|
||||
this.fond = fond;
|
||||
this.triangle = triangle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(Graphics pinceau) {
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
secondPinceau.setColor(this.fond);
|
||||
secondPinceau.fillRect(0,0,1000,1000);
|
||||
secondPinceau.setColor(this.triangle);
|
||||
int[] x = null;
|
||||
x = new int[] {150,100,175};
|
||||
int[] y = null;
|
||||
y = new int[] {100,150,175};
|
||||
secondPinceau.fillPolygon(x,y,3);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user