Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Esc key event for disposing JDialogs.

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I wanna implement the Escape key event for all the dialog boxes in my applet. I have given the key event listener on all the dialogs wherein if the key code is VK_ESCAPE then I dispose that particular dialog.

This works fine for some dialogs, also fine for dialogs which have text fields & text areas on it & these components having the focus. But the problem is for dialogs having JTables on it. If the focus is on the table then esc key doesnt work for the dialog. Even for the combo boxes as conbo boxes do not have key event handlers.

But I need to fix this problem for dialogs containing tables.

Can anyone plz suggest me a solution for this problem.

All help is appreciated.

Thanx.

Neha.....
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

Great job on this code.

This has solved my ESC key question for JDialog.

Thanks again!!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!