码迷,mamicode.com
首页 > Windows程序 > 详细

e606. Determining Which Component or Window Has the Focus

时间:2018-09-06 11:01:00      阅读:188      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!