/**
 * 
 */
package fr.univartois.bomberman.view;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JPanel;

/**
 * @author thibault
 *
 */
public class MenuView extends View {
	/**
	 * 
	 */
	private static final long serialVersionUID = 8242388999005805846L;
	
	private Image background;
	
	private JButton[] jbutton=new JButton[4];
	
	private String[] texts= {"Créer ou rejoindre une partie","Configuration générale","Configuration des touches","Quitter"};
	
	public MenuView(Window w) {
		super(w);
		
		this.setLayout(new BorderLayout());
		
		try {
			background=ImageIO.read(MenuView.class.getResourceAsStream("/sprite/menu_background.png"));
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		GridLayout layout=new GridLayout(4,1);
		JPanel panel=new JPanel(layout);
		for(int i=0;i<jbutton.length;i++) {
			jbutton[i]=new JButton(texts[i]);
			Dimension d=new Dimension(190, 49);
			jbutton[i].setSize(d);
			jbutton[i].setMinimumSize(d);
			jbutton[i].setMaximumSize(d);
			jbutton[i].setPreferredSize(d);
			panel.add(jbutton[i]);
		}
		
		this.add(panel,BorderLayout.CENTER);
		
		
	}
	/* (non-Javadoc)
	 * @see javax.swing.JComponent#paint(java.awt.Graphics)
	 */
	@Override
	public void paint(Graphics arg0) {
		
		arg0.drawImage(background, 0, 0, this);
		super.paint(arg0);
		
	}
	
	

}
