如何禁用JTabbedPane的CONTROL + PAGE_UP? [英] How to disable CONTROL+PAGE_UP of a JTabbedPane?

查看:100
本文介绍了如何禁用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");

以下是使用以下选项卡切换标签的示例Ctrl + Tab

这篇关于如何禁用JTabbedPane的CONTROL + PAGE_UP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆