Вопрос

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?

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top