码迷,mamicode.com
首页 > 其他好文 > 详细

e610. Setting Focus Traversal Keys in a Component

时间:2018-09-06 10:59:03      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:str   ali   related   when   ash   stroke   you   aci   min   

When the focus is on a component, any focus traversal keys set for that component override the default focus traversal keys. For an example of how to change the focus traversal keys for the entire application, see e611 Setting Focus Traversal Keys for the Entire Application.

    // Change the forward focus traversal keys for a component
    Set set = new HashSet(component.getFocusTraversalKeys(
        KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
    set.clear();   // Call clear() if you want to eliminate the current key set
    set.add(KeyStroke.getKeyStroke("F2"));
    component.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set);

 

Related Examples

e610. Setting Focus Traversal Keys in a Component

标签:str   ali   related   when   ash   stroke   you   aci   min   

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

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