This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Escape key Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Escape key" Watch "Escape key" New topic
Author

Escape key

Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
Is there any reason why I can't see my ESC key from the keyPressed method of a LeyListener? The ESC key works fine but if I look at my KeyEvent object passed in, there's nothing there.
Sandeep Jain
Ranch Hand

Joined: Oct 25, 2000
Posts: 124
hello,
First I am not very sure of what u really want . How ever out of my undestanding the things, I can say escape key doesnt print anything on the screen That is why u cannot see anything. However if u wanna trap that key, the ascii code for it is 27
and can implement the logic tht u want to happen on click of that event

------------------
Try and Try Till u succeed
Sandeep Jain


Try and Try Till u succeed<br /> <br />Sandeep Jain
Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
I got what I needed by using the keyReleased() method and checking for KeyEvent.VK_ESCAPE. The ESC key only invokes the keyTyped() and keyReleased() methods but even with the keyTyped() method, it won't recognize ascii code 27. It doesn't seem very consistent but at least my thing is working.
Thanks!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Escape key
 
Similar Threads
character coding problem
Problem with esc key
Esc key event for disposing JDialogs.
Register Key to a JFrame
Problem handling Esc key press