Bonsoir,

j'essaie de programmer un petit jeu, et pour l'instant je voudrais juste que quand on appuie sur une touche précise, le programme continue sinon il attend.
J'ai donc programmé ça :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
import java.awt.*;
import java.awt.event.*;
 
public class Intro 
implements KeyListener {
 
	// Début Keylistener
	public void init() {
		 addKeyListener(this);
		}
	// Fin Keylistener
 
	public static void main(String[] args)
	{
	System.out.println("Joueur 1 : x");
	System.out.println("Joueur 2 : k");
	System.out.println("Appuyez sur la touche o");
 
		while (getKeyChar()==VK_O)
		{
			System.out.println("Prêt !");
		}
	}
}
Quand je compile j'ai des erreurs
Main.java:5: error: class Intro is public, should be declared in a file named Intro.java
public class Intro
^
Main.java:10: error: cannot find symbol
addKeyListener(this);
^
symbol: method addKeyListener(Intro)
location: class Intro
Main.java:20: error: cannot find symbol
while (getKeyChar()==VK_O)
^
symbol: method getKeyChar()
location: class Intro
Main.java:20: error: cannot find symbol
while (getKeyChar()==VK_O)
^
symbol: variable VK_O
location: class Intro
4 errors
pourtant j'ai suivi ce tuto (http://b.kostrzewa.free.fr/java/td-e...tdclavier.html) mais j'ai du me louper...

Quelqu'un aurait une idée ??
merci d'avance