e617. Determining the Opposite Component of a Focus Event

Posted borter

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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的主要内容,如果未能解决你的问题,请参考以下文章

e616. Determining If a Focus Lost Is Temporary or Permanent

617. Merge Two Binary Trees

617. Merge Two Binary Trees

题解-CF617E XOR and Favorite Number

[leetcode-617-Merge Two Binary Trees]

LeetCode #617 Merge Two Binary Trees