BUT2/DEV/DEV2.1/TP09_Evenement2/test_touche/Touche.java

27 lines
740 B
Java
Raw Normal View History

2023-10-23 13:23:36 +02:00
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Touche implements KeyListener{
public Touche(){
}
@Override
public void keyTyped(KeyEvent e) {
System.out.println("L");
int touche = e.getKeyCode();
System.out.println("La touche " + touche + " a été ...");
}
@Override
public void keyPressed(KeyEvent e) {
System.out.println("L");
int touche = e.getKeyCode();
System.out.println("La touche " + touche + " a été enfoncée.");
}
@Override
public void keyReleased(KeyEvent e) {
System.out.println("L");
int touche = e.getKeyCode();
System.out.println("La touche " + touche + " a été relaché.");
}
}