47 lines
871 B
Java
47 lines
871 B
Java
|
import javax.swing.*;
|
||
|
import java.awt.*;
|
||
|
import java.awt.event.*;
|
||
|
|
||
|
public class MainFond {
|
||
|
|
||
|
public static void main(String[] args) {
|
||
|
|
||
|
int bg = 0
|
||
|
try
|
||
|
{
|
||
|
FileInputStream fis = new FileInputStream("./save.bin");
|
||
|
DataInputStream dis = new DataInputStream(fis);
|
||
|
bg = dis.readInt();
|
||
|
}
|
||
|
catch(IOException e)
|
||
|
{
|
||
|
if(e=SecurityException)
|
||
|
{
|
||
|
System.out.println("probleme de lecture");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
JFrame fenetre = new JFrame();
|
||
|
fenetre.setSize(1000, 1000);
|
||
|
fenetre.setLocation(0, 0);
|
||
|
|
||
|
Fond tamere = new Fond();
|
||
|
if (bg==1)
|
||
|
{
|
||
|
tamere.setBackground(Color.BLUE);
|
||
|
}
|
||
|
if (bg==2)
|
||
|
{
|
||
|
tamere.setBackground(Color.RED);
|
||
|
}
|
||
|
if (bg==3)
|
||
|
{
|
||
|
tamere.setBackground(Color.GREEN);
|
||
|
}
|
||
|
fenetre.add(tamere, BorderLayout.CENTER);
|
||
|
|
||
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||
|
fenetre.setVisible(true);
|
||
|
}
|
||
|
}
|