update
This commit is contained in:
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q1_Aleatoire/Q1Main.class
Normal file
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q1_Aleatoire/Q1Main.class
Normal file
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
import java.util.*;
|
||||
public class Q1Main{
|
||||
public static void main(String[] args){
|
||||
Random aleatoireGenerator = new Random();
|
||||
System.out.println("random propose : " + Math.random());
|
||||
System.out.println("nextDouble propose : " + aleatoireGenerator.nextDouble());
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q2_Puissance/Grille.class
Normal file
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q2_Puissance/Grille.class
Normal file
Binary file not shown.
50
DEV/DEV2.1/Controle_Machine_blanc/Q2_Puissance/Grille.java
Normal file
50
DEV/DEV2.1/Controle_Machine_blanc/Q2_Puissance/Grille.java
Normal file
@@ -0,0 +1,50 @@
|
||||
public class Grille{
|
||||
int[][] grille;
|
||||
|
||||
public Grille(){
|
||||
this.grille = new int[7][6];
|
||||
for (int[] colone : this.grille){
|
||||
for (int emplacement : colone){
|
||||
emplacement = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void jouer(int numColone, int couleur){
|
||||
boolean flag=false;
|
||||
int nbLigne = this.grille[0].length;
|
||||
int nbColone = this.grille.length;
|
||||
for (int i=0; i<nbLigne && flag==false; i++){
|
||||
if ((i+1)>=nbLigne || (numColone<nbColone && this.grille[numColone][i+1]!=0 && this.grille[numColone][i]==0)){
|
||||
this.grille[numColone][i] = couleur;
|
||||
flag=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String toString(){
|
||||
String affichage = new String("");
|
||||
for (int ligne=0; ligne<this.grille[0].length; ligne++){
|
||||
affichage += "│";
|
||||
for (int colone=0; colone<this.grille.length; colone++){
|
||||
if (this.grille[colone][ligne]==1){
|
||||
affichage += "○";
|
||||
affichage += "│";
|
||||
}
|
||||
if (this.grille[colone][ligne]==2){
|
||||
affichage += "●";
|
||||
affichage += "│";
|
||||
}
|
||||
if (this.grille[colone][ligne]<1 || this.grille[colone][ligne]>2){
|
||||
affichage += " ";
|
||||
affichage += "│";
|
||||
}
|
||||
}
|
||||
affichage += "\n";
|
||||
}
|
||||
affichage += "┴";
|
||||
for (int colone=0; colone<this.grille.length; colone++){
|
||||
affichage += "─┴";
|
||||
}
|
||||
return affichage;
|
||||
}
|
||||
}
|
||||
49
DEV/DEV2.1/Controle_Machine_blanc/Q2_Puissance/Grille.java~
Normal file
49
DEV/DEV2.1/Controle_Machine_blanc/Q2_Puissance/Grille.java~
Normal file
@@ -0,0 +1,49 @@
|
||||
public class Grille{
|
||||
int[][] grille;
|
||||
Grille(){
|
||||
this.grille = new int[7][6];
|
||||
for (int[] colone : this.grille){
|
||||
for (int emplacement : colone){
|
||||
emplacement = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void jouer(int numColone, int couleur){
|
||||
boolean flag=false;
|
||||
int nbLigne = this.grille[0].length;
|
||||
int nbColone = this.grille.length;
|
||||
for (int i=0; i<nbLigne && flag==false; i++){
|
||||
if ((i+1)>=nbLigne || (numColone<nbColone && this.grille[numColone][i+1]!=0 && this.grille[numColone][i]==0)){
|
||||
this.grille[numColone][i] = couleur;
|
||||
flag=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String toString(){
|
||||
String affichage = new String("");
|
||||
for (int ligne=0; ligne<this.grille[0].length; ligne++){
|
||||
affichage += "│";
|
||||
for (int colone=0; colone<this.grille.length; colone++){
|
||||
if (this.grille[colone][ligne]==1){
|
||||
affichage += "○";
|
||||
affichage += "│";
|
||||
}
|
||||
if (this.grille[colone][ligne]==2){
|
||||
affichage += "●";
|
||||
affichage += "│";
|
||||
}
|
||||
if (this.grille[colone][ligne]<1 || this.grille[colone][ligne]>2){
|
||||
affichage += " ";
|
||||
affichage += "│";
|
||||
}
|
||||
}
|
||||
affichage += "\n";
|
||||
}
|
||||
affichage += "┴";
|
||||
for (int colone=0; colone<this.grille.length; colone++){
|
||||
affichage += "─┴";
|
||||
}
|
||||
return affichage;
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q2_Puissance/Q2Main.class
Normal file
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q2_Puissance/Q2Main.class
Normal file
Binary file not shown.
12
DEV/DEV2.1/Controle_Machine_blanc/Q2_Puissance/Q2Main.java
Normal file
12
DEV/DEV2.1/Controle_Machine_blanc/Q2_Puissance/Q2Main.java
Normal file
@@ -0,0 +1,12 @@
|
||||
public class Q2Main{
|
||||
public static void main(String[] args){
|
||||
Grille puissance4 = new Grille();
|
||||
puissance4.jouer(3,1);
|
||||
puissance4.jouer(4,2);
|
||||
puissance4.jouer(3,1);
|
||||
puissance4.jouer(3,2);
|
||||
puissance4.jouer(4,1);
|
||||
puissance4.jouer(5,2);
|
||||
System.out.println(puissance4);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class Q3Main{
|
||||
public static void main(String[] args){
|
||||
JFrame fenetre = new JFrame();
|
||||
Tuile paterne = new Tuile("tuile.jpg");
|
||||
//GridLayout grille = new GridLayout(10, 10);
|
||||
//fenetre.setLayout(gestionnaire);
|
||||
fenetre.setSize(500, 500);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.add(paterne);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q4_Modelisation/Q4Main.class
Normal file
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q4_Modelisation/Q4Main.class
Normal file
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class Q4Main{
|
||||
public static void main(String[] args){
|
||||
JFrame fenetre = new JFrame();
|
||||
Tuile paterne = new Tuile("tuile.jpg");
|
||||
fenetre.setSize(500, 500);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.add(paterne);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class Q3Main{
|
||||
public static void main(String[] args){
|
||||
JFrame fenetre = new JFrame();
|
||||
Tuile paterne = new Tuile("tuile.jpg");
|
||||
fenetre.setSize(500, 500);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
fenetre.add(paterne);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q4_Modelisation/Tuile.class
Normal file
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q4_Modelisation/Tuile.class
Normal file
Binary file not shown.
28
DEV/DEV2.1/Controle_Machine_blanc/Q4_Modelisation/Tuile.java
Normal file
28
DEV/DEV2.1/Controle_Machine_blanc/Q4_Modelisation/Tuile.java
Normal file
@@ -0,0 +1,28 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class Tuile extends JComponent {
|
||||
private Image texture;
|
||||
private int longueur;
|
||||
private int hauteur;
|
||||
|
||||
public Tuile(String cheminImage) {
|
||||
super();
|
||||
this.texture = Toolkit.getDefaultToolkit().getImage(cheminImage);
|
||||
this.longueur = 512;
|
||||
this.hauteur = 512;
|
||||
}
|
||||
@Override
|
||||
protected void paintComponent(Graphics pinceau) {
|
||||
Graphics secondPinceau = pinceau.create();
|
||||
if (this.isOpaque()) {
|
||||
secondPinceau.setColor(this.getBackground());
|
||||
secondPinceau.fillRect(0, 0, this.getWidth(), this.getHeight());
|
||||
}
|
||||
for (int y=0; y<this.getHeight(); y+=this.hauteur){
|
||||
for (int x=0; x<this.getWidth(); x+=this.longueur){
|
||||
secondPinceau.drawImage(this.texture, x, y, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q4_Modelisation/tuile.jpg
Normal file
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q4_Modelisation/tuile.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
Binary file not shown.
@@ -0,0 +1,34 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
public class ActionFenetre implements WindowListener{
|
||||
private JFrame fenetre;
|
||||
|
||||
ActionFenetre(JFrame fenetre){
|
||||
this.fenetre = fenetre;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowActivated(WindowEvent evenement){
|
||||
}
|
||||
@Override
|
||||
public void windowClosed(WindowEvent evenement){
|
||||
}
|
||||
@Override
|
||||
public void windowClosing(WindowEvent evenement){
|
||||
}
|
||||
@Override
|
||||
public void windowDeactivated(WindowEvent evenement){
|
||||
}
|
||||
@Override
|
||||
public void windowDeiconified(WindowEvent evenement){
|
||||
}
|
||||
@Override
|
||||
public void windowIconified(WindowEvent evenement){
|
||||
this.fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
}
|
||||
@Override
|
||||
public void windowOpened(WindowEvent evenement){
|
||||
System.out.println("Edouard");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
public class ActionFenetre implements WindowListener{
|
||||
private JFrame fenetre;
|
||||
|
||||
ActionFenetre(JFrame fenetre){
|
||||
this.fenetre = fenetre;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void windowActivated(WindowEvent evenement){
|
||||
}
|
||||
@Override
|
||||
public void windowClosed(WindowEvent evenement){
|
||||
}
|
||||
@Override
|
||||
public void windowClosing(WindowEvent evenement){
|
||||
}
|
||||
@Override
|
||||
public void windowDeactivated(WindowEvent evenement){
|
||||
}
|
||||
@Override
|
||||
public void windowDeiconified(WindowEvent evenement){
|
||||
}
|
||||
@Override
|
||||
public void windowIconified(WindowEvent evenement){
|
||||
this.fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
}
|
||||
@Override
|
||||
public void windowOpened(WindowEvent evenement){
|
||||
}
|
||||
}
|
||||
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q5_Fermeture/Q5Main.class
Normal file
BIN
DEV/DEV2.1/Controle_Machine_blanc/Q5_Fermeture/Q5Main.class
Normal file
Binary file not shown.
16
DEV/DEV2.1/Controle_Machine_blanc/Q5_Fermeture/Q5Main.java
Normal file
16
DEV/DEV2.1/Controle_Machine_blanc/Q5_Fermeture/Q5Main.java
Normal file
@@ -0,0 +1,16 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
public class Q5Main{
|
||||
public static void main(String[] args){
|
||||
JFrame fenetre = new JFrame();
|
||||
ActionFenetre fenetreDynamique = new ActionFenetre(fenetre);
|
||||
JLabel message = new JLabel("Minimisez la fenêtre avant de la fermer !", JLabel.CENTER);
|
||||
fenetre.setSize(500, 500);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
fenetre.add(message, BorderLayout.CENTER);
|
||||
fenetre.addWindowListener(fenetreDynamique);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
16
DEV/DEV2.1/Controle_Machine_blanc/Q5_Fermeture/Q5Main.java~
Normal file
16
DEV/DEV2.1/Controle_Machine_blanc/Q5_Fermeture/Q5Main.java~
Normal file
@@ -0,0 +1,16 @@
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
public class Q5Main{
|
||||
public static void main(String[] args){
|
||||
JFrame fenetre = new JFrame();
|
||||
ActionFenetre fenetreDynamique = new ActionFenetre(fenetre);
|
||||
JLabel message = new JLabel("Minimisez la fenêtre avant de la fermer !", JLabel.CENTER);
|
||||
fenetre.setSize(500, 500);
|
||||
fenetre.setLocation(0, 0);
|
||||
fenetre.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
fenetre.add(message, BorderLayout.CENTER);
|
||||
fenetre.addWindowListener(fenetreDynamique);
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user