david session perdu
This commit is contained in:
67
DEV2.1/Flux_octet_Suite/Memoire.java
Normal file
67
DEV2.1/Flux_octet_Suite/Memoire.java
Normal 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user