This example changes the focus traversal keys for the entire application. For an example of how to change the focus traversal keys for a particular component, see e610 Setting Focus Traversal Keys in a Component.

    // Change the forward focus traversal keys for the application
Set set = new HashSet(
KeyboardFocusManager.getCurrentKeyboardFocusManager().getDefaultFocusTraversalKeys(
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS));
set.clear(); // Call clear() if you want to eliminate the current key set
set.add(KeyStroke.getKeyStroke("F2"));
KeyboardFocusManager.getCurrentKeyboardFocusManager().setDefaultFocusTraversalKeys(
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set); // Change the backward focus traversal keys for the application
set = new HashSet(
KeyboardFocusManager.getCurrentKeyboardFocusManager().getDefaultFocusTraversalKeys(
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS));
set.clear(); // Call clear() if you want to eliminate the current key set
set.add(KeyStroke.getKeyStroke("F3"));
KeyboardFocusManager.getCurrentKeyboardFocusManager().setDefaultFocusTraversalKeys(
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, set); // Remove all forward and backward focus traversal keys for the application
set.clear();
KeyboardFocusManager.getCurrentKeyboardFocusManager().setDefaultFocusTraversalKeys(
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set);
KeyboardFocusManager.getCurrentKeyboardFocusManager().setDefaultFocusTraversalKeys(
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, set);
Related Examples

e611. Setting Focus Traversal Keys for the Entire Application的更多相关文章

  1. e610. Setting Focus Traversal Keys in a Component

    When the focus is on a component, any focus traversal keys set for that component override the defau ...

  2. e613. Modifying the Focus Traversal Order

    JFrame frame = new JFrame(); JButton component1 = new JButton("1"); JButton component2 = n ...

  3. How to remove focus without setting focus to another control?

    How to remove focus without setting focus to another control? Ask Question up vote 67 down vote favo ...

  4. 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 ...

  5. How to exit the entire application from a Python thread?

    If all your threads except the main ones are daemons, the best approach is generally thread.interrup ...

  6. 【移动端debug-4】iOS下setTimeout无法触发focus事件的解决方案

    开篇总结:其实目前无法解决这个bug. 这两天做项目遇到了这个case,项目需求是打开页面的时候,input元素自动弹起键盘.由于各种方面的考虑,我们希望通过setTimeout延时200毫秒让inp ...

  7. UI Framework-1: Aura Focus and Activation

    Focus and Activation Focus and Activation are closely related.   Definitions Focused window - this i ...

  8. qt qml 类型之Keys

    Keys 类是 Qt Quick 提供的,专门供 Item 处理按键事件的类.它定义了很多针对特定按键的信号,比如 onReturnPressed / onEscapePressed / onDown ...

  9. 关于redis的keys命令的性能问题

    KEYS pattern 查找所有符合给定模式 pattern 的 key . KEYS * 匹配数据库中所有 key . KEYS h?llo 匹配 hello , hallo 和 hxllo 等. ...

随机推荐

  1. Oracle 数据库连接池

    jdbc:oracle:thin:@(DESCRIPTION=(failover=on)(enable=broken)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOS ...

  2. 每日英语:A Chinese Soccer Club Has Won Something!

    A 1-1 tie at home was sufficient for Guangzhou Evergrande to clinch the Asian Champions League title ...

  3. excel 添加换行符,去除换行符:

    excel 中添加换行符: :alt+enter 去掉excel中的换行符有三种方法: 注:解决过程中翻阅其他博客,看到如下方式: 1.看到有的说全选后“取消自动换行”,保存后,再打开,依然存在换行符 ...

  4. (转)CTP: 平昨仓与平今仓,log轻轻告诉你.......

    转自:http://blog.csdn.net/wowotuo/article/details/43242663 CTP的相关文档告诉我们,中金所和三大商品交易所中,只有上期所区分平今仓和平昨仓.也就 ...

  5. H3C AP实现定时重启

    #job radio_diable  view system  time 1 repeating at 03:00 command wlan radio disable all  time 2 rep ...

  6. js利用clipboardData在网页中实现截屏粘贴的功能

    目前仅有高版本的 Chrome 浏览器支持这样直接粘贴,其他浏览器目前为止还无法粘贴,不过火狐和ie11浏览器在可编辑的div中能够粘贴截图的图片也是base64位和Chrome利用clipboard ...

  7. 在python3.3后urllib2已经不能再用,只能用urllib.request来代替

    版权声明:本文为博主原创文章,未经博主允许不得转载. 在python3.3后urllib2已经不能再用,只能用urllib.request来代替 response=urllib2.urlopen(' ...

  8. docker探索-docker安装运行tomcat(六)

    前言      本地已经搭建好了,tomcat容器,本来想自己写一篇,在开源中国一篇不错的教程,就转载过来了 本文转自:https://my.oschina.net/sunchp/blog/61652 ...

  9. PHP——大话PHP设计模式——基本设计模式(工厂模式、单例模式、注册器模式)

  10. PHP——安装wampserver丢失MSVCR110.dll

    win8系统 64位,在安装wampserver时显示计算机丢失MSVCR110.dll   1.首先是打开浏览器,在浏览器的地址栏里输入 http://www.microsoft.com/zh-CN ...