import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.io.File;
import java.io.IOException;

/**
 * Ecran de démarrage du logiciel
 */
public class AppThinkerSplashscreen extends JFrame {

    /**
     * Constructeur - Crée la fenêtre de démarrage
     */
    public AppThinkerSplashscreen(){
        this.setTitle("AppThinker - Starting");
        this.setMinimumSize(new Dimension(533, 300));
        Image img = null;
        try { img = ImageIO.read(AppThinker.class.getResource("img/logoAppThinker.png")); } catch (Exception ex) { }
        this.setIconImage(img);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setLocationRelativeTo(null);
        this.setUndecorated(true);

        JPanel panel = new JPanel(){
            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                Graphics2D g2 = (Graphics2D) g;
                Image img = null;
                try { img = ImageIO.read(AppThinker.class.getResource("img/splashscreen.png")); } catch (Exception ex) { }
                g2.drawImage(img, 0, 0, 533, 300, this);
                /*Informations du logiciel*/
                g2.setColor(new Color(63, 169, 245));
                g2.setFont(new Font("Arial", Font.BOLD, 40));
                g2.drawString("AppThinker", 305, 45);
                g2.setFont(new Font("Arial", Font.PLAIN, 20));
                g2.drawString("Make your ideas come true", 285, 280);
                g2.setFont(new Font("Arial", Font.BOLD, 10));
                g2.drawString("We're getting things ready...", 5, 295);
                g2.drawString("V.BOULANGER (c) 2020 - Version 1.0.0-dev4", 305, 295);
            }
        };

        this.getContentPane().add(panel);
        this.setVisible(true);
    }
}
