39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
import java.awt.*;
|
|
import javax.swing.*;
|
|
import java.io.*;
|
|
|
|
public class Mainfond2{
|
|
|
|
public static void main(String[] args) {
|
|
try{
|
|
DataInputStream file = new DataInputStream(new FileInputStream ("taille.bin"));
|
|
BufferedInputStream file2 = new BufferedInputStream(file);
|
|
try {
|
|
JFrame fenetre = new JFrame();
|
|
Fond2 pan = new Fond2();
|
|
int x = file.readInt();
|
|
int y = file.readInt();
|
|
fenetre.setSize(x, y);
|
|
fenetre.setLocation(0, 0);
|
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
fenetre.setContentPane(pan);
|
|
fenetre.setVisible(true);
|
|
file2.close();
|
|
try{
|
|
DataOutputStream outputfile = new DataOutputStream(new FileOutputStream ("taille.bin"));
|
|
outputfile.writeInt(250);
|
|
outputfile.writeInt(300);
|
|
outputfile.flush();
|
|
}catch(FileNotFoundException e){}
|
|
} catch(IOException e){}
|
|
}catch(FileNotFoundException e){
|
|
JFrame fenetre = new JFrame();
|
|
Fond2 pan = new Fond2();
|
|
fenetre.setSize(500, 500);
|
|
fenetre.setLocation(0, 0);
|
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
fenetre.setContentPane(pan);
|
|
fenetre.setVisible(true);
|
|
}
|
|
}
|
|
} |