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.事件源:产生事件的地方,可以是页面中的输入框,按 ...
随机推荐
- 字符测试与映射函数 ctype.h
对于C Standard Library 可以参考:http://www.acm.uiuc.edu/webmonkeys/book/c_guide/ 或者 http://www.cplusplus.c ...
- cocos2dx+lua注册事件函数详解 事件
coocs2dx 版本 3.1.1 registerScriptTouchHandler 注册触屏事件 registerScriptTapHandler ...
- Lua string.gsub (s, pattern, repl [, n])
lua的string函数导出在string module中.在lua5.1,同时也作为string类型的成员方法,因此,我们既可以写成string.gsub (s,……), 也可以s:gsub(). ...
- openfire聊天记录插件
package com.sqj.openfire.chat.logs; import java.io.File; import java.util.Date; import java.util.Lis ...
- 多媒体文件格式之TS
[时间:2016-07] [状态:Open] TS流是MPEG-2标准中定义一种用于直播的码流结构,具有很好的容错能力.所有跟TS相关的标准可以从ISO/IEC_13818-1中找到. 通常TS流的后 ...
- 邮箱登录form表单样例
index.html <!doctype html> <html lang="en"> <head> <meta charset=&quo ...
- HttpClient request payload post请求
RequestEntity entity = new StringRequestEntity(str, "text/html", "utf-8"); post. ...
- Pythonic版二分查找
[本文出自天外归云的博客园] 前提:升序数组,待查元素在数组中. 二分查找:就是一个递归函数c.待查元素a,当前数组中位数b,如果b=a则返回b的索引,b>a则在b左侧的子数组中调用函数c,否则 ...
- script 页面在指定位置加载
<head> <script> function load(){window.location="#workspaces"} </script> ...
- django HttpResponse对象
HttpResponse对象 概述: 作用:给浏览器返回数据 HttpRequest对象是由Django创建的,HttpResponse对象是由程序员创建 用法: 不用模板,直接返回数据 语句示例:r ...