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

public class ContenantJDialog extends JDialog implements KeyListener{
	
	private Monde monde;
	private Entite leContenant;
	private JLabel getLbl=new JLabel("PRENDRE (,)");
	private JLabel dropLbl=new JLabel("DEPOSER (d)");
	
	private ParcheminFond pfond=new ParcheminFond();
	
	
	public ContenantJDialog(Monde world,Entite selected){
		Font police=world.getPolice();
		monde=world;
		leContenant=selected;
		Container c=getContentPane();
		c.setLayout(null);
		
		
		getLbl.setFont(police);
		dropLbl.setFont(police);
		
		
		
		
		
		getLbl.setBounds(10,10,110,20);
		c.add(getLbl);
		
		
		dropLbl.setBounds(110,10,110,20);
		c.add(dropLbl);
		
		addKeyListener(this);
		
		
		if(monde.jeuPan.lang){
			getLbl.setText("GET (,)");
			dropLbl.setText("DROP (d)");
		}
		
		
		pfond.setBounds(0,0,230,80);
		add(pfond);
		
		
		
		setLocation(0,0);
		setSize(230,80);
		show();
		
	}
	
	public void keyPressed(KeyEvent e){
		char lettre=e.getKeyChar();
		
		if(lettre==','){
			monde.perso.retourContenantJDialog(leContenant,"getContenant");
			dispose();
		}
		
		if(lettre=='d'){
			monde.perso.retourContenantJDialog(leContenant,"dropContenant");
			dispose();
		}
		
	
	}
	public void keyReleased(KeyEvent e){}
	
	public void keyTyped(KeyEvent e){}
	
	
}