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 26 27 28 29 30 31
|
public class machin extends javax.swing.JApplet implements KeyListener{
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
this.getContentPane().setBackground(Color.black);
this.setSize(640,480);
addKeyListener(this);
}
public void keyTyped(KeyEvent e) {
}
public void keyPressed(KeyEvent e) {
jLabel1.setText("pre" + e.getKeyChar());
}
public void keyReleased(KeyEvent e) {
} |
Partager