e621. Activating a Keystroke When Any Child Component Has Focus
Normally, a keystroke registered on a component is activated when the component has the focus. This type of activation condition is called WHEN_FOCUSED
. It is possible to specify that a keystroke be activated if it or any child or descendant component has the focus. This type of keystroke activation condition is called WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
.
An example where this type of keystroke activation condition is useful is in the case of a scrollpane that handles scrolling navigation keystrokes even when the child component has the focus.
There are three types of activation conditions available: WHEN_FOCUSED
, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
, and WHEN_IN_FOCUSED_WINDOW
. See e620 Activating a Keystroke When Any Component in the Window Has Focus for more details about these activation conditions.
// To create an action, see e855 创建一个事件 // Register keystroke
component.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
KeyStroke.getKeyStroke("F2"), action.getValue(Action.NAME)); // Register action
component.getActionMap().put(action.getValue(Action.NAME), action);
Related Examples |
e621. Activating a Keystroke When Any Child Component Has Focus的更多相关文章
- e620. Activating a Keystroke When Any Component in the Window Has Focus
Normally, a keystroke registered to a component is activated when the component has the focus. This ...
- [Angular 2] @ViewChild to access Child component's method
When you want to access child component's method, you can use @ViewChild in the parent: Parent Compo ...
- [Vue] Parent and Child component communcation
By building components, you can extend basic HTML elements and reuse encapsulated code. Most options ...
- vue & child component & props
vue & child component & props vue pass data to child component https://vuejs.org/v2/guide/co ...
- react 函数子组件(Function ad Child Component)
今天学习了react中的函数子组件的概念,然后在工作中得到了实际应用,很开心,那么好记性不如烂笔头,开始喽~ 函数子组件(FaCC )与高阶组件做的事情很相似, 都是对原来的组件进行了加强,类似装饰者 ...
- Vue Parent Send Ajax Data to Child Component
Vue 父组件ajax异步更新数据,子组件props获取不到 2018年06月26日 09:25:06 哎哟嘿 阅读数 3585 当父组件 axjos 获取数据,子组件使用 props 接 ...
- [React] React Fundamentals: Accessing Child Properties
When you're building your React components, you'll probably want to access child properties of the m ...
- e610. Setting Focus Traversal Keys in a Component
When the focus is on a component, any focus traversal keys set for that component override the defau ...
- [React] Forward a DOM reference to another Component using forwardRef in React 16.3
The function forwardRef allows us to extract a ref and pass it to its descendants. This is a powerfu ...
随机推荐
- Python2 字典 has_key() 方法
描述 Python2 字典 has_key() 方法用于判断键(key)是否存在于字典(D)中,如果键在字典中返回True,否则返回False. 官方文档推荐用 in 操作符,因为它更短更通俗易懂.h ...
- openvpn上查看谁在连接服务端
在服务端/etc/openvpn目录里面有ipp.txt和openvpn-status.log,这两个文件里面记录了,访问服务器的ip网段和地址.但是这两个文件也不是专门干这个用的,也算是一种另类的用 ...
- js动态创建表格,删除行列的小例子
js动态创建表格,删除行列的实例代码. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" &quo ...
- 【精】iOS 文件操作:沙盒(SandBox)、文件操作(FileManager)、程序包(NSBundle)
1.沙盒机制介绍 iOS 中的沙盒机制(SandBox)是一种安全体系. 每一个 iOS 应用程序都有一个单独的文件系统(存储空间).并且仅仅能在相应的文件系统中进行操作,此区域被称为沙盒. 全部的非 ...
- 写个关于使用cocostudio Armature实现动画自由切换的小demo
这是一个关于使用cocostudio实现动画自由切换的小demo auto sprite =Sprite::create("background.png"); sprite-> ...
- 关于python调用zabbix api接口
因公司业务需要,引进了自动化运维,所用到的监控平台为zbbix3.2,最近正在学习python,计划使用python调用zabbix api接口去做些事情,如生成报表,我想最基本的是要取得zabbix ...
- cocos2d-x 父节点和子节点执行不同动作
Test6::Test6() { CCSprite* sp1 = CCSprite::create(s_pPathSister1); CCSprite* sp11 = CCSprite::create ...
- C++ 11 std::function std::bind使用
cocos new 出新的项目之后,仔细阅读代码,才发现了一句3.0区别于2.0的代码: auto closeItem = MenuItemImage::create( "CloseNorm ...
- ARM获得PC指针为何PC=PC+8
http://blog.csdn.net/sddzycnqjn/article/details/7691534 R15(PC)总是指向“正在取指”的指令,而不是指向“正在执行”的指令或正在“译码”的指 ...
- 锁与theadLocal的合并使用
); , TimeUnit.); ){ , TimeUnit.); ){ ); infoPO.setRemainAmount(infoPO.getRemainAmount()-amount); bas ...