import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

import java.util.*;

//tests sauvegarde
//import java.io.*;


public class DialogLoadGame extends JDialog implements ActionListener{
	
	//Font police=new Font("Serif",Font.BOLD,12);
	
	private JLabel nomLbl=new JLabel("Qui etes vous ?");
	
	
	private JTextField nomTxtF=new JTextField("");
	
	private JButton okBtn=new JButton("OK");
	
	private Monde monde;
	
	
	private ParcheminFond pfond=new ParcheminFond();
	
	
	
	public DialogLoadGame(Monde world){
		Font police=world.getPolice();
		
		monde=world;
		
		Container c=getContentPane();
		c.setLayout(null);
		
		nomLbl.setBounds(10,10,100,20);
		nomTxtF.setBounds(10,40,130,20);
		okBtn.setBounds(50,70,70,20);
		
		c.add(nomLbl);
		c.add(nomTxtF);
		c.add(okBtn);
		
		okBtn.addActionListener(this);
		
		setTitle("Charger partie");
		
		if(monde.jeuPan.lang){
			nomLbl.setText("Who are you ?");
			setTitle("Load Game");
		}
		
		
		nomLbl.setFont(police);
		okBtn.setFont(police);
		
		
		pfond.setBounds(0,0,200,150);
		add(pfond);
		
		
		setSize(200,150);
		show();
		
	}
	
	
	public void actionPerformed(ActionEvent e){
		
		Object source=e.getSource();
		
		if(source==okBtn){
			if(nomTxtF.getText().compareTo("")!=0){
			
				monde.loadGame(nomTxtF.getText());
			}
			
			dispose();
			
		}
		
	}
}