import java.io.File;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.UIManager;
/**
 * Projet: PaintRevolution
 * <p>Titre :FenetrePrincipale.java </p>
 * <p>Description : Classe contenant la fenetre principale</p>
 * <p>Copyright : Copyright (c) 2005</p>
 * <p>Société : IUT CHARLEMAGNE NANCY II</p>
 * @author VIGNERON GEOFFROY && GANGANELLI DORIAN
 * @version 3.0
 */
public class JFramePrincipale extends JFrame{
    /**
     * MenuBar contenu dans la fenetre
     */
    private MenuBar menu;
    
    /**
     * Constructeur de la fenetre proncipale
     * @param n une chaine definissant le titre du programme
     */
    public JFramePrincipale(String n) {
        super(n);
        
        // Definition du LookAndFeel
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }
        
        //image du programme
        JLabel image= new JLabel(new ImageIcon("image" + File.separator + "PAINTREVOLUTION.jpg"));
        JPanel p=new JPanel();
        p.add(image);
        
        //creation de la barre de menu
        menu = new MenuBar(this);
        this.getContentPane().add(p);
        this.pack();
        this.setExtendedState(JFrame.MAXIMIZED_BOTH);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setVisible(true);
        this.setResizable(true);
    }
    /**
     * Méthode permettant de recuperer un element
     * du menu 
     * @return un MenuBar
     */
    public MenuBar getMenu(){
        return menu;
    }

    /**
     * Méthode permettant de recuperer un element
     * du panel principale
     * @return le panel principale et panel internte de la fenetre principale
     */
    public PanelJFramePrincipale getPanel(){
        return (PanelJFramePrincipale)this.getContentPane();
    }
}
