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.事件源:产生事件的地方,可以是页面中的输入框,按 ...
随机推荐
- 如何打开chrome中flash debug player
If you’ve installed the latest version of Google Chrome, and you are having a problem debugging your ...
- 使用canvas制作简单表格
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- 二分查找算法(Python版)
[本文出自天外归云的博客园] 记性不好(@.@),所以平时根本用不到的东西就算学过如果让我去想也会需要很多时间(*.*)! 二分查找算法 在一个有序数组中查找元素最快的算法,也就是折半查找法,先找一个 ...
- Oracle 项目中 SQL 脚本更新方式
DECLARE hasVersion ); dbVersion ); BEGIN ) INTO hasVersion FROM ELB_SETTINGS E WHERE E.KEY='dbVersio ...
- JAVA-JSP内置对象之application对象获得其他信息
相关资料:<21天学通Java Web开发> application对象获得其他信息1.通过调用application对象的其他方法可以获得更多信息,如文件的MIME类型.获得指定Loca ...
- faster rcnn流程
1.执行流程 数据准备 train_net.py中combined_roidb函数会调用get_imdb得到datasets中factory.py生成的imdb 然后调用fast_rcnn下的trai ...
- [转]Oracle中Hint深入理解
原文地址:http://czmmiao.iteye.com/blog/1478465 Hint概述 基于代价的优化器是很聪明的,在绝大多数情况下它会选择正确的优化器,减轻了DBA的负担.但有时它也聪明 ...
- 加快Terminal的打开加载速度
加快Terminal的打开加载速度html, body {overflow-x: initial !important;}.CodeMirror { height: auto; } .CodeMirr ...
- Cacti的库表结构-Data
cacti 的数据都是存放在rrdtool 中的,数据库存放的其实只是配置数据,cacti 的逻辑对象主要分为三种,data (数据).graph (图片).host (设备),这在它的表设计中也能很 ...
- WPF打包工具
找到一款相当不错的WPF项目的打包工具:advanced installer 工具简单易用,有破/解版,还可以把项目依赖库一起打到一个包中. 用法参考: https://www.cnblogs.com ...