/**
 * 
 */
package gui;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

import modeles.Salle;

/**
 * @author nicolas
 *
 */
public class JeuSalle extends JFrame implements KeyListener,ActionListener{
	public char nb;
	public JeuSalle() {
		setTitle("Labyrinthe"); 
		setSize(1200,600); 
		setLocationRelativeTo(null); 
		setResizable(false); 
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		//setContentPane(ecrire("test"));
		//JScrollPane test = new JScrollPane();
		//setContentPane(test);
		this.setVisible(true);
		
	
	}
	public JPanel ecrire(String str) {
		JPanel panel = new JPanel();
		panel.setLayout(new FlowLayout());
		JLabel label = new JLabel(str);
		panel.add(label);
		this.setFocusable(true);
		this.setContentPane(panel);
		this.addKeyListener(this);
		this.requestFocus();
		
		return panel;
	}
	/* (non-Javadoc)
	 * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
	 */
	@Override
	public void keyPressed(KeyEvent e) {
		//System.out.println("keyPressed");
		int codeint =e.getKeyCode();
				
		//int codeint=Character.getNumericValue(e.getKeyText(code));
		//System.out.println(codeint);
		//String key =e.getKeyText(code);
		//System.out.println(key);
		
		
		
	}
	/* (non-Javadoc)
	 * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
	 */
	@Override
	public void keyReleased(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}
	/* (non-Javadoc)
	 * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)
	 */
	@Override
	public void keyTyped(KeyEvent e) {
		// TODO Auto-generated method stub
		 nb = e.getKeyChar();
		System.out.println(nb);
		//System.out.println(nb);
		
	}
	/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
		
	}
	public char toucheint() {
		System.out.println("sortie"+nb);
		return nb;
	}
	public void cacher(JPanel panel) {
		panel.setVisible(false);
	}
	
}
