本文介绍了如何禁用JTabbedPane的CONTROL + PAGE_UP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何禁用JTabbedPane
的CONTROL + PAGE_UP和CONTROL + PAGE_DOWN的默认行为?
How to disable the default behavior of CONTROL+PAGE_UP and CONTROL+PAGE_DOWN of a JTabbedPane
?
推荐答案
以下代码禁用了常规行为
The following code disables the usual behavior
JTabbedPane jTabbedPane = new JTabbedPane();
KeyStroke ctrlTab = KeyStroke.getKeyStroke("ctrl PAGE_DOWN");
KeyStroke ctrlShiftTab = KeyStroke.getKeyStroke("ctrl PAGE_UP");
InputMap inputMap = jTabbedPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(ctrlTab, "none");
inputMap.put(ctrlShiftTab, "none");
这篇关于如何禁用JTabbedPane的CONTROL + PAGE_UP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!