e617. Determining the Opposite Component of a Focus Event
The opposite component is the other component affected in a focus event. Specifically, in a focus-lost event, the opposite component is the one gaining the focus. In a focus-gain event, the opposite component is the one losing the focus.
Sometimes the opposite component is null, which indicates that the component is in some other application.
component.addFocusListener(new MyFocusListener());
public class MyFocusListener extends FocusAdapter {
public void focusGained(FocusEvent evt) {
// The component that lost the focus
Component c = evt.getOppositeComponent();
}
public void focusLost(FocusEvent evt) {
// The component that gained the focus
Component c = evt.getOppositeComponent();
}
}
| Related Examples |
e617. Determining the Opposite Component of a Focus Event的更多相关文章
- [HTML5] Using the focus event to improve navigation accessibility (nextElementSibling)
For a menu item, when we tab onto it, we want this element get 'focus' event, so that the submenu wi ...
- e606. Determining Which Component or Window Has the Focus
// null is returned if none of the components in this application has the focus Component compFocusO ...
- 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 ...
- e616. Determining If a Focus Lost Is Temporary or Permanent
A temporary focus-lost event occurs if the focus moves to another window. It's temporary because the ...
- 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 ...
- e614. Setting the Initial Focused Component in a Window
There is no straightforward way to set the initial focused component in a window. The typical method ...
- e609. Listening to All Focus Changes Between Components in an Application
To listen to focus change events between components, install a listener with the keyboard focus mana ...
- e615. Finding the Next Focusable Component
public Component findNextFocus() { // Find focus owner Component c = KeyboardFocusManager.getCurrent ...
- salesforce lightning零基础学习(四) 事件(component events)简单介绍
lightning component基于事件驱动模型来处理用户界面的交互.这种事件驱动模型和js的事件驱动模型也很相似,可以简单的理解成四部分: 1.事件源:产生事件的地方,可以是页面中的输入框,按 ...
随机推荐
- [Windows Azure] Windows Azure Execution Models
Windows Azure Execution Models Windows Azure provides different execution models for running applica ...
- 关于RPG游戏结构撰写的相关探索上篇
本章节的目标是创造一个游戏理念.这个理念是: *简短的项目概括 *范围描述 *目标用户 *与其他游戏的区别 不要试图编写一款缺乏明确理念的RPG.因为这样可能只会产生与其他游戏雷同的项目. <i ...
- 运行Virtualbox去安装系统时出错:Failed to open a session for the virtual machine,Unable to load R3 module xxxx/VBoxDD.DLL(VBoxDD)
貌似看到不少人(1,2,3),在使用Virtualbox去安装系统时,都遇到这个错误: 比如这里遇到的: 截图: 和另外这里的截图: 加文字描述: Failed to open a session f ...
- signal函数的原型声明void (*signal(int signo, void (*fun(int))))(int)分析
转:http://blog.sina.com.cn/s/blog_4850a7880100hnam.html void (*signal(int signo, void (*fun(int))))(i ...
- js设置cookie(原生js)
cookie 与 session 是网页开发中常用的信息存储方式.Cookie是在客户端开辟的一块可存储用户信息的地方:Session是在服务器内存中开辟的一块存储用户信息的地方. JavaScrip ...
- Windows下MFC程序利用LockCop解决死锁
死锁现象:在训练的时候,点击“终止”按钮时不时会发生死锁. 检测工具:LockCop.TRACE宏.::GetCurrentThreadID函数. 检测手段: 总结起来就是—— 第一步:用LockCo ...
- TextView
wrap_content 设置TextView的宽度和高度为 wrap_content,则其大小会自动适应文本. textSize 设置字体大小 textColor 设置字体颜色 <TextVi ...
- hdu1598
思路:对所有路径的速度从小到大排个序,然后枚举高度差就ok...... #include<iostream> #include<cstdio> #include<cstr ...
- IOS 地图移动中心点获取
MKMap显示地图后,如果用户移动了地图,自己定义的数据就需要刷新了,所以这个时候,中心点的经纬度就比较重要了. 本文演示如何获取经纬度 在MKMapViewDelegate里有个方法 - (void ...
- JQUERY的给Check全选功能
//给Checkbox提供全选功能 $("#checkall").click(function(){ if(this.checked){ $("input[name='c ...