diff --git a/DEV2.1/CM1/Configuration.class b/DEV2.1/CM1/Configuration.class new file mode 100644 index 0000000..d6d1137 Binary files /dev/null and b/DEV2.1/CM1/Configuration.class differ diff --git a/DEV2.1/CM1/Configuration.java b/DEV2.1/CM1/Configuration.java new file mode 100644 index 0000000..7fccbb8 --- /dev/null +++ b/DEV2.1/CM1/Configuration.java @@ -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; + } +} \ No newline at end of file diff --git a/DEV2.1/CM1/Declinaisons.class b/DEV2.1/CM1/Declinaisons.class new file mode 100644 index 0000000..3698817 Binary files /dev/null and b/DEV2.1/CM1/Declinaisons.class differ diff --git a/DEV2.1/CM1/Declinaisons.java b/DEV2.1/CM1/Declinaisons.java new file mode 100644 index 0000000..304ddd5 --- /dev/null +++ b/DEV2.1/CM1/Declinaisons.java @@ -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); + } +} diff --git a/DEV2.1/CM1/Duplication.class b/DEV2.1/CM1/Duplication.class new file mode 100644 index 0000000..cf5280d Binary files /dev/null and b/DEV2.1/CM1/Duplication.class differ diff --git a/DEV2.1/CM1/Duplication.java b/DEV2.1/CM1/Duplication.java new file mode 100644 index 0000000..29cf429 --- /dev/null +++ b/DEV2.1/CM1/Duplication.java @@ -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(); + } +} \ No newline at end of file diff --git a/DEV2.1/CM1/Partie.class b/DEV2.1/CM1/Partie.class new file mode 100644 index 0000000..203107f Binary files /dev/null and b/DEV2.1/CM1/Partie.class differ diff --git a/DEV2.1/CM1/Partie.java b/DEV2.1/CM1/Partie.java new file mode 100644 index 0000000..038fca6 --- /dev/null +++ b/DEV2.1/CM1/Partie.java @@ -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); + } +} \ No newline at end of file diff --git a/DEV2.1/Exception/ex2/ArithmeticExceptionExample.class b/DEV2.1/Exception/ex2/ArithmeticExceptionExample.class new file mode 100644 index 0000000..78070ae Binary files /dev/null and b/DEV2.1/Exception/ex2/ArithmeticExceptionExample.class differ diff --git a/DEV2.1/Exception/ex2/Main.java b/DEV2.1/Exception/ex2/Main.java index f968057..f257846 100644 --- a/DEV2.1/Exception/ex2/Main.java +++ b/DEV2.1/Exception/ex2/Main.java @@ -3,7 +3,7 @@ public class Main { try { ArithmeticExceptionVrai.computeDivision(); } catch (ArithmeticException e) { - System.out.println("Une erreur arithmétique s'est produite : " + e.getMessage()); + System.out.println("Une erreur arithm├ętique s'est produite : " + e.getMessage()); } } -} +} \ No newline at end of file diff --git a/DEV2.1/Exception/ex3/Incomplet.class b/DEV2.1/Exception/ex3/Incomplet.class new file mode 100644 index 0000000..71766ff Binary files /dev/null and b/DEV2.1/Exception/ex3/Incomplet.class differ diff --git a/DEV2.1/Flux_octet/Coloriage/Coloriage.class b/DEV2.1/Flux_octet/Coloriage/Coloriage.class new file mode 100644 index 0000000..289bf4d Binary files /dev/null and b/DEV2.1/Flux_octet/Coloriage/Coloriage.class differ diff --git a/DEV2.1/Flux_octet/Coloriage/Coloriage.java b/DEV2.1/Flux_octet/Coloriage/Coloriage.java new file mode 100644 index 0000000..8310231 --- /dev/null +++ b/DEV2.1/Flux_octet/Coloriage/Coloriage.java @@ -0,0 +1,28 @@ +import javax.swing.*; +import java.awt.*; +import java.util.*; +import java.awt.event.*; +import java.io.*; + +public class Coloriage extends JComponent{ + + public Coloriage(Color couleur){ + JFrame fenetre = new JFrame(); + fenetre.setLocation(100,100); + fenetre.setSize(500,500); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + fenetre.setVisible(true); + try{ + FileOutputStream fos = new FileOutputStream("couleur.bin"); + int blue = couleur.getBlue(); + int red = couleur.getRed(); + int green = couleur.getGreen(); + fos.write(blue); + fos.write(red); + fos.write(green); + + }catch(IOException e){ + System.err.println("erreur d'ecriture"); + } + } +} \ No newline at end of file diff --git a/DEV2.1/Flux_octet/Coloriage/ColoriageTest.class b/DEV2.1/Flux_octet/Coloriage/ColoriageTest.class new file mode 100644 index 0000000..b0f8caa Binary files /dev/null and b/DEV2.1/Flux_octet/Coloriage/ColoriageTest.class differ diff --git a/DEV2.1/Flux_octet/Coloriage/ColoriageTest.java b/DEV2.1/Flux_octet/Coloriage/ColoriageTest.java new file mode 100644 index 0000000..3aab886 --- /dev/null +++ b/DEV2.1/Flux_octet/Coloriage/ColoriageTest.java @@ -0,0 +1,17 @@ +import javax.swing.*; +import java.awt.*; +import java.util.*; +import java.awt.event.*; +import java.io.*; +import java.awt.Color; + +public class ColoriageTest{ + + public static void main(String[] args) { + Color couleur = new Color(0,0,0); + couleur.decode(args[0]); + //String couleur2 = args[1];// + Coloriage coloriage = new Coloriage(couleur); + } + +} \ No newline at end of file diff --git a/DEV2.1/Flux_octet/Coloriage/couleur.bin b/DEV2.1/Flux_octet/Coloriage/couleur.bin new file mode 100644 index 0000000..4227ca4 Binary files /dev/null and b/DEV2.1/Flux_octet/Coloriage/couleur.bin differ diff --git a/DEV2.1/Flux_octet/Memoire/Fond.class b/DEV2.1/Flux_octet/Memoire/Fond.class new file mode 100644 index 0000000..1dbdcb2 Binary files /dev/null and b/DEV2.1/Flux_octet/Memoire/Fond.class differ diff --git a/DEV2.1/Flux_octet/Memoire/Fond.java b/DEV2.1/Flux_octet/Memoire/Fond.java new file mode 100644 index 0000000..0191cc3 --- /dev/null +++ b/DEV2.1/Flux_octet/Memoire/Fond.java @@ -0,0 +1,44 @@ +import javax.swing.*; +import java.awt.*; +import java.util.*; +import java.awt.event.*; + +public class Fond extends JPanel implements ActionListener{ + + public Fond(){ + super(); + // Création des boutons + JButton cyanButton = new JButton("Cyan"); + JButton magentaButton = new JButton("Magenta"); + JButton yellowButton = new JButton("Jaune"); + + // Ajout des action listeners aux boutons + cyanButton.addActionListener(this); + magentaButton.addActionListener(this); + yellowButton.addActionListener(this); + + // Création du panneau pour contrôler la couleur de fond + this.add(cyanButton); + this.add(magentaButton); + this.add(yellowButton); + } + + @Override + public void actionPerformed(ActionEvent e) { + String command = e.getActionCommand(); + switch (command) { + case "Cyan": + this.setBackground(Color.CYAN); + break; + case "Magenta": + this.setBackground(Color.MAGENTA); + break; + case "Jaune": + this.setBackground(Color.YELLOW); + break; + default: + break; + } + + } +} \ No newline at end of file diff --git a/DEV2.1/Flux_octet/Memoire/Memoire.class b/DEV2.1/Flux_octet/Memoire/Memoire.class new file mode 100644 index 0000000..09b18e8 Binary files /dev/null and b/DEV2.1/Flux_octet/Memoire/Memoire.class differ diff --git a/DEV2.1/Flux_octet/Memoire/Memoire.java b/DEV2.1/Flux_octet/Memoire/Memoire.java new file mode 100644 index 0000000..2349e64 --- /dev/null +++ b/DEV2.1/Flux_octet/Memoire/Memoire.java @@ -0,0 +1,70 @@ +import javax.swing.*; +import java.awt.*; +import java.util.*; +import java.awt.event.*; +import java.io.*; + +public class Memoire extends JFrame implements WindowListener{ + public void windowClosed(WindowEvent evenement){} + public void windowActivated(WindowEvent evenement){} + public void windowClosing(WindowEvent evenement){ + try { + FileOutputStream fos = new FileOutputStream("position.bin"); + DataOutputStream dos = new DataOutputStream(fos); + + int w = this.getWidth(); + int h = this.getHeight(); + int x = this.getX(); + int y = this.getY(); + + dos.writeInt(x); + dos.writeInt(y); + dos.writeInt(h); + dos.writeInt(w); + System.out.println("info stockee"); + + + this.dispose(); + }catch(Exception e){ + System.out.println("erreur stockage"); + } + + } + public void windowDeactivated(WindowEvent evenement){} + public void windowDeiconified(WindowEvent evenement){} + public void windowIconified(WindowEvent evenement){} + public void windowOpened(WindowEvent evenement){} + + + public Memoire(){ + super(); + + + try { + FileInputStream fis = new FileInputStream("position.bin"); + DataInputStream dis = new DataInputStream(fis); + int x = dis.readInt(); + int y = dis.readInt(); + int h = dis.readInt(); + int w = dis.readInt(); + + this.setLocation(x,y); + this.setSize(w,h); + + }catch(Exception e){ + System.out.println("Ouverture par defaut"); + this.setLocation(100, 100); + this.setSize(500,500); + } + + this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + + Fond fond = new Fond(); + this.add(fond); + + this.setVisible(true); + this.addWindowListener(this); + } + +} + diff --git a/DEV2.1/Flux_octet/Memoire/Test_memoire.class b/DEV2.1/Flux_octet/Memoire/Test_memoire.class new file mode 100644 index 0000000..6b434d7 Binary files /dev/null and b/DEV2.1/Flux_octet/Memoire/Test_memoire.class differ diff --git a/DEV2.1/Flux_octet/Memoire/Test_memoire.java b/DEV2.1/Flux_octet/Memoire/Test_memoire.java new file mode 100644 index 0000000..fa6d7f2 --- /dev/null +++ b/DEV2.1/Flux_octet/Memoire/Test_memoire.java @@ -0,0 +1,13 @@ +import javax.swing.*; +import java.awt.*; +import java.util.*; +import java.awt.event.*; + +public class Test_memoire { + + public static void main(String[] args) { + + Memoire memoire = new Memoire(); + + } +} \ No newline at end of file diff --git a/DEV2.1/Flux_octet/Memoire/position.bin b/DEV2.1/Flux_octet/Memoire/position.bin new file mode 100644 index 0000000..2bfc4c7 Binary files /dev/null and b/DEV2.1/Flux_octet/Memoire/position.bin differ diff --git a/DEV2.1/Flux_octet/image/Imagee.class b/DEV2.1/Flux_octet/image/Imagee.class new file mode 100644 index 0000000..c04ef6b Binary files /dev/null and b/DEV2.1/Flux_octet/image/Imagee.class differ diff --git a/DEV2.1/Flux_octet/image/Imagee.java b/DEV2.1/Flux_octet/image/Imagee.java new file mode 100644 index 0000000..33ed4e2 --- /dev/null +++ b/DEV2.1/Flux_octet/image/Imagee.java @@ -0,0 +1,40 @@ +import javax.swing.*; +import java.awt.*; +import java.awt.image.*; +import java.io.*; + +public class Imagee extends JComponent { + + private Image image; + + public Imagee(int width, int height, String path) throws IOException{ + image = readFromFile (width, height, path); + setPreferredSize(new Dimension(width, height)); + } + + private Image readFromFile (int width, int height, String path) throws IOException{ + FileInputStream input = new FileInputStream(path); + BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); + byte[] read_buffer = new byte[width * height * 3]; + input.read(read_buffer); + + int[] int_buffer = new int[read_buffer.length]; + for (int i = 0;i < read_buffer.length ; i++) + int_buffer[i] = read_buffer[i] & 0xFF; + img.getRaster().setPixels(0,0,width,height,int_buffer); + + return img; + + } + + @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()); + } + secondPinceau.setColor(this.getForeground()); + secondPinceau.drawImage(image, 0 ,0 , this); + } +} \ No newline at end of file diff --git a/DEV2.1/Flux_octet/image/ImgTest.class b/DEV2.1/Flux_octet/image/ImgTest.class new file mode 100644 index 0000000..0d1d7b3 Binary files /dev/null and b/DEV2.1/Flux_octet/image/ImgTest.class differ diff --git a/DEV2.1/Flux_octet/image/ImgTest.java b/DEV2.1/Flux_octet/image/ImgTest.java new file mode 100644 index 0000000..eaa5e95 --- /dev/null +++ b/DEV2.1/Flux_octet/image/ImgTest.java @@ -0,0 +1,27 @@ +import javax.swing.*; +import java.awt.*; +import java.io.*; + +public class ImgTest { + + public static void main(String[] args) { + + JFrame fenetre = new JFrame("Image"); + fenetre.setSize(768,1024); + fenetre.setLocationRelativeTo(null); + fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + try{ + Imagee img = new Imagee(768, 1024,"image.bin"); + fenetre.add(img); + }catch(IOException e){ + System.out.println("probleme"); + } + + + + + fenetre.setVisible(true); + + } +} \ No newline at end of file diff --git a/DEV2.1/Flux_octet/image/image.bin b/DEV2.1/Flux_octet/image/image.bin new file mode 100644 index 0000000..1bf996b Binary files /dev/null and b/DEV2.1/Flux_octet/image/image.bin differ diff --git a/DEV2.1/Polymophisme/ex2/Moyenne1.java b/DEV2.1/Polymophisme/ex2/Moyenne1.java index 79f89dd..fab8dab 100644 --- a/DEV2.1/Polymophisme/ex2/Moyenne1.java +++ b/DEV2.1/Polymophisme/ex2/Moyenne1.java @@ -29,7 +29,7 @@ public class Moyenne1 { public void add(float val){ this.moyenne+= (double)val; - this.nbr_valeur+=1; + tcouleur2his.nbr_valeur+=1; } public void add(double val){ diff --git a/DEV2.1/felix-vi_CM1.tar.gz b/DEV2.1/felix-vi_CM1.tar.gz new file mode 100644 index 0000000..80c1215 Binary files /dev/null and b/DEV2.1/felix-vi_CM1.tar.gz differ