david session perdu

This commit is contained in:
2024-04-29 16:30:04 +02:00
parent f411998b31
commit dde6dfef96
13 changed files with 19295 additions and 5 deletions

3108
DEV2.1/DCU_DC/Exo1.mdj Normal file

File diff suppressed because it is too large Load Diff

3295
DEV2.1/DCU_DC/Exo3.mdj Normal file

File diff suppressed because it is too large Load Diff

12750
DEV2.1/DCU_DC/exo2.mdj Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -17,9 +17,11 @@ public class Coloriage extends JComponent{
int blue = couleur.getBlue();
int red = couleur.getRed();
int green = couleur.getGreen();
for (int i= 0; i < 500; i++){
fos.write(blue);
fos.write(red);
fos.write(green);
}
}catch(IOException e){
System.err.println("erreur d'ecriture");

View File

@@ -8,7 +8,7 @@ import java.awt.Color;
public class ColoriageTest{
public static void main(String[] args) {
Color couleur = new Color(0,0,0);
Color couleur = new Color(255,255,255);
couleur.decode(args[0]);
//String couleur2 = args[1];//
Coloriage coloriage = new Coloriage(couleur);

Binary file not shown.

View File

@@ -12,7 +12,7 @@ public class ImgTest {
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
try{
Imagee img = new Imagee(768, 1024,"image.bin");
Imagee img = new Imagee(768, 1024,"couleur.bin");
fenetre.add(img);
}catch(IOException e){
System.out.println("probleme");

View File

@@ -0,0 +1,55 @@
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
public class Fond extends JPanel implements ActionListener{
private Color coul_fond;
public Fond(Color couleur){
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);
this.setBackground(couleur);
coul_fond = couleur;
}
public Color Der_col(){
return coul_fond;
}
@Override
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
switch (command) {
case "Cyan":
this.setBackground(Color.CYAN);
coul_fond = Color.CYAN;
break;
case "Magenta":
this.setBackground(Color.MAGENTA);
coul_fond = Color.MAGENTA;
break;
case "Jaune":
this.setBackground(Color.YELLOW);
coul_fond = Color.YELLOW;
break;
default:
break;
}
}
}

View File

@@ -0,0 +1,67 @@
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 {
ObjectOutputStream dos = new ObjectOutputStream("position.bin");
Dimension dim = new Dimension(this.getWidth(),this.getHeight());
Point poi = new Point(this.getX(),this.getY());
Object dimension = (Object) dim;
Object point = (Object) poi;
Object coul = (Object)
dos.writeObject(xdimension);
dos.writeObject(point);
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 {
ObjestInputStream dis = new ObjestInputStream("position.bin");
Dimension dim = (Dimension) dis.readObject();
Point poi = (Point) dis.readObject();
Color col = (Color) dis.readObject();
this.setLocation(poi);
this.setSize(dim);
Fond fond = new Fond();
this.add(fond);
}catch(Exception e){
System.out.println("Ouverture par defaut");
this.setLocation(100, 100);
this.setSize(500,500);
Fond fond = new Fond(Color.WHITE);
this.add(fond);
}
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.setVisible(true);
this.addWindowListener(this);
}
}

View File

@@ -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();
}
}