Pergunta

I can catch event in a custom component using processKeyEvent method like this way.

class CustomComp extends JPanel
{
   @Override
   public void processKeyEvent(final KeyEvent event)
    {
     if (event.getKeyCode() == KeyEvent.VK_DOWN)
      {
          //do somthing here
      }
   }
}

is there any alternative ways to do that?

Foi útil?

Solução

The preferred method would probably be to use the Key Bindings API

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top