[英]Is there a Swing element which has F6 as a default accelerator?
I have an application with a tabbed pane and different components in it. 我有一个带有选项卡式窗格的应用程序,其中包含不同的组件。 I have set a MenuItem as Action with an Accelerator: 我已使用加速器将MenuItem设置为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 there is one tab where the Accelearator for the F6 key doesn't work. 我知道有一个选项卡,其中F6键的Accelearator不起作用。 the F7 key works. F7键起作用。
Is there maybe a default accelerator on a Swing Element that has priority over my accelerator? Swing Element上是否有默认加速器优先于我的加速器?
You can look this up in BasicLookAndFeel.java (or similar class depending on the L&F you use), search on F6. 你可以在BasicLookAndFeel.java(或类似的类,取决于你使用的L&F)中查找,在F6上搜索。
Looks like F6 is used by JSplitPane to toggle focus between the content and the dividers. 看起来JSplitPane使用F6在内容和分隔符之间切换焦点。 To remove it you could use something like (not tested, I think removing the actual action is harder because it might be in a parent input map): 要删除它,你可以使用类似的东西(未测试,我认为删除实际操作更难,因为它可能在父输入映射中):
splitPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
.put(KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0), "none");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.