|
|
|
@ -14,12 +14,14 @@ 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);
|
|
|
|
@ -50,10 +52,15 @@ public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void keyPressed(KeyEvent e) {
|
|
|
|
|
System.out.println("keyPressed");
|
|
|
|
|
int code=e.getKeyCode();
|
|
|
|
|
String key =e.getKeyText(code);
|
|
|
|
|
System.out.println(key);
|
|
|
|
|
//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)
|
|
|
|
@ -70,6 +77,9 @@ public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
|
|
|
|
@Override
|
|
|
|
|
public void keyTyped(KeyEvent e) {
|
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
nb = e.getKeyChar();
|
|
|
|
|
System.out.println(nb);
|
|
|
|
|
//System.out.println(nb);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/* (non-Javadoc)
|
|
|
|
@ -81,5 +91,12 @@ public class JeuSalle extends JFrame implements KeyListener,ActionListener{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public char toucheint() {
|
|
|
|
|
System.out.println("sortie"+nb);
|
|
|
|
|
return nb;
|
|
|
|
|
}
|
|
|
|
|
public void cacher(JPanel panel) {
|
|
|
|
|
panel.setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|