Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JFrame - How to trap keyboard events

Status
Not open for further replies.

BillyKrow

Programmer
Aug 27, 2001
67
0
0
US
I have a JFrame and I want to trap keyboard events and make decisions on the event before they actually get sent to components within the JFrame. The problem with the java.awt.event.KeyListener class is that it only listens to events and does not intervene and cannot stop them from happening. Does anybody know how to do this?
 
If you implement a KeyListener, I believe you have control over what happens on that event - so if you don't want a certain key press event to actually do anything, then you can control that.

See the tutorial
--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Once you catch an event, it has already "happened". Anyway, you can consume the event so no one else will notice.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top