Ajout des travaux effectuer

This commit is contained in:
2024-12-09 11:53:11 +01:00
parent 05fac8d3ae
commit c4e97e13da
558 changed files with 67900 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,30 @@
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Fond extends JPanel implements ActionListener
{
public Fond(){
super();
JButton cyan = new JButton("Cyan");
JButton magenta = new JButton("Magenta");
JButton jaune = new JButton("Jaune");
this.add(cyan);
this.add(magenta);
this.add(jaune);
cyan.addActionListener(this);
magenta.addActionListener(this);
jaune.addActionListener(this);
}
public void actionPerformed(ActionEvent evenement){
String test;
test = evenement.getActionCommand();
if(test.equals("Cyan")){
this.setBackground(Color.CYAN);
}if(test.equals("Magenta")){
this.setBackground(Color.MAGENTA);
}if(test.equals("Jaune")){
this.setBackground(Color.YELLOW);
}
}
}

Binary file not shown.

View File

@@ -0,0 +1,21 @@
import javax.swing.*;
import java.awt.*;
import java.io.*;
import java.awt.image.BufferedImage;
public class Test{
public static void main(String[] args){
JFrame fenetre = new JFrame();
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fenetre.add(new Fond());
fenetre.setVisible(true);
try{
FileInputStream file = new FileInputStream("/tmp/memoire/save.bin");
BufferedInputStream buff = new BufferedInputStream(file);
}catch(IOException e){
fenetre.setSize(300, 300);
fenetre.setLocation(100, 100);
}
}
}

View File

@@ -0,0 +1,36 @@
import javax.swing.*;
import java.awt.*;
import java.io.*;
public class memoire{
public void windowOpened(WindowEvent event){
Window window = event.getWindow();
Point defaultLocation = new Point(0, 0);
Dimension defaultDimension = Dimension(400, 400);
try(ObjectInputStream input = new ObjectInputStream(new FileInputStream("/tmp/memoire/save.bin"))){
Object location = input.readObject();
Object size = input.readObject();
if(size instanceof Point){
defaultLocation = (Point)location;
}
if(size instanceof Dimension){
defaultDimension = (Dimension)size;
}
}catch(IOException | ClassNotFoundException e){
}
window.setLocation(defaultLocation);
window.setSize(defaultDimension);
}
public void windowClosing(WindowEvent event){
Window window = event.getWindow();
try(ObjectOutputStream input = new ObjectOutputStream(new FileOutputStream("/tmp/memoire/save.bin"))){
input.writeObject(window.getLocation());
input.writeObject(window.getSize());
}catch(IOException | ClassNotFoundException e){
System.out.println(e.getMessage);
}
}
public memoire(){
super();
}
}

View File

@@ -0,0 +1,36 @@
import javax.swing.*;
import java.awt.*;
import java.io.*;
public class memoire extends implement{
public void windowOpened(WindowEvent event){
Window window = event.getWindow();
Point defaultLocation = new Point(0, 0);
Dimension defaultDimension = Dimension(400, 400);
try(ObjectInputStream input = new ObjectInputStream(new FileInputStream("/tmp/memoire/save.bin"))){
Object location = input.readObject();
Object size = input.readObject();
if(size instanceof Point){
defaultLocation = (Point)location;
}
if(size instanceof Dimension){
defaultDimension = (Dimension)size;
}
}catch(IOException | ClassNotFoundException e){
}
window.setLocation(defaultLocation);
window.setSize(defaultDimension);
}
public void windowClosing(WindowEvent event){
Window window = event.getWindow();
try(ObjectOutputStream input = new ObjectOutputStream(new FileOutputStream("/tmp/memoire/save.bin"))){
input.writeObject(window.getLocation());
input.writeObject(window.getSize());
}catch(IOException | ClassNotFoundException e){
System.out.println(e.getMessage);
}
}
public memoire(){
super();
}
}