DEV/DEV2.1/TP9:FluxOctets/Mainfond2.java
2023-05-09 11:26:45 +02:00

33 lines
940 B
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();
} 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);
}
}
}