Is there a Swing element that has F6 as the default accelerator?

I have a tab app with various components. I set MenuItem as an accelerator action:

private final Action focusDefaultCommandsAction = new AbstractAction() { { putValue(NAME, "Fokusiere Kommandoliste"); putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0)); } @Override public void actionPerformed(final ActionEvent e) { invokeShowCommandsList(); } }; 

I know that there is one tab where the Accelearator for the F6 key does not work. F7 key works.

Is it possible that the default accelerator for the Swing Element takes precedence over my accelerator?

+6
source share
1 answer

You can see this in BasicLookAndFeel.java (or a similar class depending on the L & F you use), search on F6.

It looks like F6 is used by JSplitPane to switch focus between content and delimiters. To remove it, you can use something like (not verified, I think that deleting the actual action is harder because it might be in the parent input map):

 splitPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) .put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), "none"); 
+9
source

Source: https://habr.com/ru/post/902209/


All Articles