e606. Determining Which Component or Window Has the Focus

2021-07-12 18:13

阅读:507

标签:determine   add   example   windows   ffffff   pad   enter   focus   ati   

    // null is returned if none of the components in this application has the focus
    Component compFocusOwner =
        KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    
    // null is returned if none of the windows in this application has the focus
    Window windowFocusOwner =
        KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow();
    
    // Use this method to determine whether a particular component has the focus
    boolean b = component.isFocusOwner();

 

Related Examples

e606. Determining Which Component or Window Has the Focus

标签:determine   add   example   windows   ffffff   pad   enter   focus   ati   

原文地址:https://www.cnblogs.com/borter/p/9596084.html


评论


亲,登录后才可以留言!