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 ...
随机推荐
- Xfire实现webservice时,对象传递规则及解析简析
Xfire实现webservice,传递对象解析的话,要分两种情况处理:1.基本类型对象:2.复杂对象 其实,在客户端直接传递数组,如String[] int[]等这些无法通过配置具体类型来通知xfi ...
- mysql工作中常见问题
1.Error Code: 1044 - Access denied for user 'root'@'localhost' to database 'information_schema'Query ...
- 关于使用REST API
设计REST API的请求处理部分 REST API功能 通常, 我们希望借助REST API完成以下操作 - 创建一个新记录 - 读取一个list的记录 - 读取指定的记录 - 更新指定记录 - 删 ...
- unity5 Orthographic模式相机视截体尺寸计算
一,通过编辑器中数值计算. 如图,相机为Orthographic模式,其camera size为5.57,是什么含义呢,经过测量,发现视图中视截体的高度是5.57x2. 那么视截体的宽度怎么决定呢? ...
- 鼠标移至div内部其他层时,触发mouseout
话说有一个DIV元素,其内部有一个IMG元素和SPAN元素,不用理会这两个内部元素怎么布局,这不是我要讨论的重点. 为了实现一些特殊的效果,我需要利用TD的onmouseover和onmouseout ...
- Linux下修改时间时区的方法介绍
点评:在Linux中,用于时钟查看和设置的命令主要有date.hwclock和clock.其中,clock和 hwclock用法相近,只不过clock命令除了支持x86硬件体系外,还支持Alpha硬件 ...
- hdoj 1027 Ignatius and the Princess II 【逆康托展开】
Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ( ...
- ControlExtensionTest(一)
#ifndef __CCCONTROLSCENE_H__ #define __CCCONTROLSCENE_H__ #include "cocos2d.h" #include &q ...
- linux命令(24):/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
/etc/profile./etc/bashrc.~/.bash_profile.~/.bashrc很容易混淆,他们之间有什么区别?它们的作用到底是什么? /etc/profile: 用来设置系统环境 ...
- Spark: Best practice for retrieving big data from RDD to local machine
've got big RDD(1gb) in yarn cluster. On local machine, which use this cluster I have only 512 mb. I ...