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 ...
随机推荐
- find命令之exec和xargs
exec: find是我们很常用的一个Linux命令,但是我们一般查找出来的并不仅仅是看看而已,还会有进一步的操作,这个时候exec的作用就显现出来了. exec解释: -exec 参数后面跟的是c ...
- PHP二维数组如何根据某个字段排序
分享下PHP二维数组如何根据某个字段排序的方法. 从两个不同的表中获取各自的4条数据,然后整合(array_merge)成一个数组,再根据数据的创建时间降序排序取前4条. 本文记录的要实现的功能类似于 ...
- Lerp和SmoothDamp比较
Lerp更像是线性衰减,而SmoothDamp像是弧形衰减,两者都是由快而慢 其中SmoothDamp多用于相机跟随.但如果其他类型的插值,我个人觉的其实都差不多 SmoothDamp: transf ...
- 【Android】4.3 屏幕布局和旋转
分类:C#.Android.VS2015:创建日期:2016-02-06 为了控制屏幕的放置方向(纵向.横向),可以在Resource下同时定义两种不同的布局文件夹:layout和layout-lan ...
- c语言double类型数据四舍五入
借助math库的round函数 #include <math.h> double ext_round(double data, int precision) { , precision); ...
- solr学习之一 搜索基本知识
学习了一段时间的solr了,用自己的方式总结下目前学到的内容,这是个系列文章,这里面的有些说法可能不准确,也可能有问题 欢迎大家指正. 一.搜索引擎目的 搜索引擎在我们的生活中,已经无处不在,除了我们 ...
- mysql data_add data_sub
DATE_SUB() 函数从日期减去指定的时间间隔. 语法 DATE_SUB(date,INTERVAL expr type) date 参数是合法的日期表达式.expr 参数是您希望添加的时间间隔. ...
- android从Dialog对话框中取得文本文字
android中Dialog对话框获取文本文字,只需要使用editor的getText方法就可以获得,示例如下:final EditText et = new EditText(this); et.s ...
- jacky自问自答-java并发编程
1.java Web中线程不是由tomcat这类web容器负责的吗?为什么还要我控制多线程? 答:这个问题很多初学者都会有的疑惑,举一个我以前做的一个需求,java作为中间平台,是socket服务端, ...
- 实现qsort(和qsort差一个数量级啊,伤自尊了)
#include <cstdio> #include <cstdint> #include <ctime> #include <cstring> #in ...