void (KeyEvent event) { Object source = event.getSource(); if (source instanceof JTree tree) { if (!hasAction(KeyStroke.getKeyStrokeForEvent(event), tree.getInputMap())) { delegateKeyEvent(event); } } }