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的更多相关文章

  1. [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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. e615. Finding the Next Focusable Component

    public Component findNextFocus() { // Find focus owner Component c = KeyboardFocusManager.getCurrent ...

  9. salesforce lightning零基础学习(四) 事件(component events)简单介绍

    lightning component基于事件驱动模型来处理用户界面的交互.这种事件驱动模型和js的事件驱动模型也很相似,可以简单的理解成四部分: 1.事件源:产生事件的地方,可以是页面中的输入框,按 ...

随机推荐

  1. 使用instantclient_11_2和pl/sql Developer连接oracle远程数据库

    https://blog.csdn.net/itmyhome1990/article/details/8796781 ***************************************** ...

  2. iOS开发:代码通用性以及其规范 第一篇(附带,自定义UITextView\进度条\双表显示\瀑布流 代码设计思路)

    在iOS团队开发中,我见过一些人的代码,也修改过他们的代码.有的人的代码写的非常之规范.通用,几乎不用交流,就可以知道如何修改以及在它基础上扩展延生.有的人的代码写的很垃圾,一眼看过去,简直会怀疑自己 ...

  3. [转]javaweb学习总结(二十九)——EL表达式

    原文地址:https://www.cnblogs.com/xdp-gacl/p/3938361.html 一.EL表达式简介 EL 全名为Expression Language.EL主要作用: 1.获 ...

  4. iOS中 语音识别功能/语音转文字教程具体解释 韩俊强的博客

    原文地址:http://blog.csdn.net/qq_31810357/article/details/51111702 前言:近期研究了一下语音识别,从百度语音识别到讯飞语音识别:首先说一下个人 ...

  5. nginx报502 bad GateWay错误的解决方法

    nginx+php-fpm+mysql的网站,访问nginx的某个页面,报502 GateWay的错误,一般见到此错误,可以判断是php-fpm的问题,而不是nginx的问题.通过监控nginx的错误 ...

  6. JDBC插入数据超长时无法自动截断问题

    问题 JDBC操作MySQL数据库,当进行插入或更新操作的数据长度超过表字段的声明最大长度时,会报出以下错误,导致不能正常插入: 但是当直接在MySQL客户端操作时,发现确实可以的,只不过会自动对插入 ...

  7. JVM内存的设置

    一.JVM内存的设置的原理 默认的java虚拟机的大小比较小,在对大数据进行处理时java就会报错:java.lang.OutOfMemoryError. 设置jvm内存的方法,对于单独的.class ...

  8. sql逻辑查询 理论知识

    参考并转载http://www.cnblogs.com/bhtfg538/archive/2008/11/25/1341016.html First: (8) SELECT (9) DISTINCT  ...

  9. linux系统管理命令(五)

    [教程主题]:1.系统管理命令 [1.1]用户和组管理 在Linux操作系统中,任何文件都归属于某一特定的用户,而任何用户都隶属于至少一个用户组.用户是否有权限对某文件进行访问.读写以及执行,受到系统 ...

  10. linux 的服务与进程管理(二)

    2.linux 的服务与进程管理 [2.1]系统启动流程 简单的介绍下linux的系统启动流程,方便我们深入了解linux操作系统,对排除linux系统故障进行帮助.启动流程虽然简单但背后还有着更加复 ...