• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

KeyListener Problem

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Application was working fine and we upgraded to java1.4.2 and no changes done in java code. In my case, whenever user presses F1 key, the key event is getting handled correctly and it is opening help page.

But now the event is not getting captured even though there is a listener to catch.

Below is the code snippet.

------------------------


private void HelpKey()
{
try
{
java.awt.event.KeyListener keyListener = new java.awt.event.KeyAdapter()
{
public void keyReleased( java.awt.event.KeyEvent e )
{
// Check that the key released was F1
// and that some component was active
if ( getFocusOwner() != null && e.getKeyCode() == java.awt.event.KeyEvent.VK_F1 )
{ // Finally call the method in my controller and
// pass the active component as an argument
FormHelpURL( getFocusOwner() );
}

}
};
// add previously created listener to this window
addKeyListener( keyListener );
}


Could you please throw some light and give some pointers....

Thanks in advance.
 
reply
    Bookmark Topic Watch Topic
  • New Topic