Results 1 to 2 of 2
  1. #1
    sahildave1991 Guest

    Default what is the problem in this program ?????

    Java Code:
    package EventHandling;
    
    import java.awt.*;
    import java.awt.event.*;
    
    public class KeyEvents implements KeyListener
    {
    	int i;
    	public void keyPressed(KeyEvent e) 
    	{
    		i= e.getKeyChar();
    		System.out.println("VALUE IS ::"+i);
    	}
    	public void keyReleased(KeyEvent e) {}
    	public void keyTyped(KeyEvent e) {}
    
    }

    i want to print the char value of each key i press...
    wat is the problem...it is not responding //

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    I've no idea given the information you've provided for us as we don't know how you're using this class at all. Could it be that the component that is being listened to doesn't have focus? Again, we've no way of knowing.

Similar Threads

  1. Problem in Program
    By Abbinormal in forum New To Java
    Replies: 9
    Last Post: 01-08-2010, 03:38 AM
  2. Problem with the below program
    By srikanthnambu in forum Java 2D
    Replies: 1
    Last Post: 05-20-2009, 05:43 PM
  3. Gui program problem..
    By mingming2009 in forum Advanced Java
    Replies: 7
    Last Post: 04-03-2009, 05:15 AM
  4. Program problem
    By arindamchkrbrty in forum New To Java
    Replies: 8
    Last Post: 03-10-2009, 04:58 AM
  5. program problem
    By amith in forum AWT / Swing
    Replies: 12
    Last Post: 05-16-2008, 08:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •