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. DBeaver利用方式简介

    当攻击者能够进入内网,同时发现某台服务器装有弱口令的数据库时,除了在console中查看数据库信息外, 还可以利用第三方工具进行数据库读取,本例中使用DBeaver进行查看. 1. 下载DBeaver ...

  2. HBase写入性能及改造——multi-thread flush and compaction(续:详细测试数据)[转]

    转载:http://blog.csdn.net/kalaamong/article/details/7290192 接上文啊: 测试机性能 CPU 16* Intel(R) Xeon(R) CPU   ...

  3. 兼容ios和Android的复制js代码

    //2种方法本人全部亲测有效 方法1:比较简单 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ...

  4. kali下添加PATH环境变量

    添加PATH环境变量,第1种方法: [root@lx_web_s1 ~]# export PATH=/usr/local/webserver/mysql/bin:$PATH 再次查看: [root@l ...

  5. Linux下golang开发环境搭建

    对于golang开发来说,Windows下可以用vscode或者liteide都不错,但是Linux下的开发也就只有vim了,所以怎么搞笑的利用vim进行golang开发呢? 参考官方推荐的一个插件: ...

  6. Animation.setFillAfter and Animation.setFillBefore的作用

    转:http://blog.csdn.net/yangweigbh/article/details/9788531 setFillAfter(boolean fillAfter)  在Android ...

  7. 【Java】LinkedBlockingQueue、PriorityQueue and ConcurrentLinkedQueue

    1.LinkedBlockingQueue: 基于链接节点的可选限定的blocking queue . 这个队列排列元素FIFO(先进先出). 队列的头部是队列中最长的元素. 队列的尾部是队列中最短时 ...

  8. eclipse jetty 请求的操作无法在使用用户映射区域打开的文件上执行

    使用jetty  debug代码启动  在eclipse中进行运行调试,碰到无法编辑保存webapp下的文件 提示: 请求的操作无法在使用用户映射区域打开的文件上执行 解决方法: 从 jetty 7 ...

  9. plsql 安装后database下拉没有东西(转)

    转载自:http://www.cnblogs.com/yaobolove/p/5682982.html 今天来说一下问题,就是装了plsql竟然在database这一栏没有东西,我也是纠结了很久,感觉 ...

  10. java基础篇---网络编程(TCP程序设计)

    TCP程序设计 在Java中使用Socket(即套接字)完成TCP程序的开发,使用此类可以方便的建立可靠地,双向的,持续的,点对点的通讯连接. 在Socket的程序开发中,服务器端使用serverSo ...