The preferred method would probably be to use the Key Bindings API
how to catch event from a custom component
-
30-06-2022 - |
質問
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?
解決
所属していません StackOverflow