문제

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