Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/06/2013, 17:06
Avatar de erozwashere
erozwashere
 
Fecha de Ingreso: noviembre-2012
Ubicación: mex
Mensajes: 176
Antigüedad: 11 años, 4 meses
Puntos: 0
Saber que tecla precione, en netbeans

Hola que tal, tengo un problem al precionar una tecla debe de mostrar un mensaje en pantalla con el nombre de la tecla y su codigo, todo esto con JOptionPane

actualmente tengo esto, todavia no tutlizo JOptionpane, pero no funciona enseguida se termina de ejecutar el programa, Gracias por sus respuestas
Código Java:
Ver original
  1. *
  2. package javaapplication7;
  3. import java.util.*;
  4. import javax.swing.*;
  5. import java.awt.event.KeyEvent;
  6. import java.awt.event.KeyListener;
  7.  
  8. public class JavaApplication7 implements KeyListener {
  9.  
  10.     /**
  11.      * @param args the command line arguments
  12.      */
  13.        
  14.     public static void main(String[] args) {
  15.         // TODO code application logic here
  16.        
  17.    
  18.      
  19.    
  20.  
  21.        
  22.         System.out.println("PRECIONA UNA TECLA");
  23.    
  24.    
  25.        
  26.     }
  27.  
  28.    
  29.     public void keyTyped(KeyEvent e) {
  30.        
  31.     }
  32.  
  33.    
  34.     public void keyPressed(KeyEvent e) {
  35.     char c = e.getKeyChar();
  36. System.out.println(c);
  37.      
  38.     }
  39.  
  40.     public void keyReleased(KeyEvent e) {
  41.      
  42.     }
  43. }