JFrame frame = new JFrame();
JButton component1 = new JButton("1");
JButton component2 = new JButton("2");
JButton component3 = new JButton("3"); // By default, the focus traversal order is the same as the insertion order
frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().add(component1);
frame.getContentPane().add(component2);
frame.getContentPane().add(component3); // Change the order from 1,2,3 to 1,3,2
component1.setNextFocusableComponent(component3);
component3.setNextFocusableComponent(component2);
component2.setNextFocusableComponent(component1); // Restore the order to 1,2,3
component1.setNextFocusableComponent(null);
component2.setNextFocusableComponent(null);
component3.setNextFocusableComponent(null);
Related Examples

e613. Modifying the Focus Traversal Order的更多相关文章

  1. e611. Setting Focus Traversal Keys for the Entire Application

    This example changes the focus traversal keys for the entire application. For an example of how to c ...

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

  3. UI Framework-1: Aura Focus and Activation

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

  4. 开发一个Swing功能时的一点总结

    对JTextField进行效验,有两个途径:(1)是使用javax.swing.InputVerifier在获取焦点时进行校验(2)在点击“确定”按钮的监听事件中对控件的值进行校验 鉴于涉及的业务比较 ...

  5. 2.5 – Garbage Collection 自动垃圾回收 Stop-the-world vs. incremental vs. concurrent 垃圾回收策略

    2.5 – Garbage Collection  自动垃圾回收 Lua 5.3 Reference Manual http://www.lua.org/manual/5.3/manual.html# ...

  6. LinkedBlockingQueueE(示例,出错代码)

    java.util.concurrent 类 LinkedBlockingQueue<E> java.lang.Object java.util.AbstractCollection< ...

  7. Java多线程系列--“JUC集合”07之 ArrayBlockingQueue

    概要 本章对Java.util.concurrent包中的ArrayBlockingQueue类进行详细的介绍.内容包括:ArrayBlockingQueue介绍ArrayBlockingQueue原 ...

  8. Java多线程系列--“JUC集合”08之 LinkedBlockingQueue

    概要 本章介绍JUC包中的LinkedBlockingQueue.内容包括:LinkedBlockingQueue介绍LinkedBlockingQueue原理和数据结构LinkedBlockingQ ...

  9. Java多线程系列--“JUC集合”09之 LinkedBlockingDeque

    概要 本章介绍JUC包中的LinkedBlockingDeque.内容包括:LinkedBlockingDeque介绍LinkedBlockingDeque原理和数据结构LinkedBlockingD ...

随机推荐

  1. wireshark抓取本地数据包

    windows系统中,本地向自身发送数据包没有经过真实的网络接口,而是通过环路(loopback interface)接口发送,所以使用基于只能从真实网络接口中抓数据的winpcap是无法抓取本地数据 ...

  2. iOS开发之按钮的基本使用

    实现功能: 点击向上的箭头,按钮图片向上,移动,点击向下的箭头,按钮图片向下移动 点击向左的箭头,按钮图片向左移动,点击向右的箭头,按钮图片向右移动, 点击加号图片放大,点击减号,图片缩小 第一步: ...

  3. linux下文件描述符的查看及分析

    起因 近期在调试一个Android播放内核是遇到上层传递的是fd(file descriptor),但是在文件播放结束之后调用lseek却提示返回-1,errno=29(#define ESPIPE ...

  4. tf.nn.sigmoid_cross_entropy_with_logits

    tf.nn.sigmoid_cross_entropy_with_logits sigmoid_cross_entropy_with_logits( _sentinel=None, labels=No ...

  5. ios 6.1中 Release问题

    程序中有如下代码: UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Something was done." m ...

  6. iOS全局变量的声明和使用

    在一个项目中,我们可能需要定义几个全局变量,在我们程序的任何位置都可以进行访问,提高我们的开发效率.在iOS中我们如何来实现呢?我们主要使用的是AppDelegate类来实现.如下: (1)AppDe ...

  7. python json (loads(),load(),jump(),jumps())

    # loads() str to json data# jumps() json to str# jump() json to filedef ladstest(): data = '{"n ...

  8. Linux下 jenkins的安装

    自动代码部署的 jenkins 安装, 第一步,从网上下载jenkins的war包 http://mirrors.jenkins.io/war/2.46/ 第二步:复制到tomcat的编译目录下去编译 ...

  9. 微服务之springCloud和docker-provide(二)

    简介 通过上一节我们已经通过docker-compose在swarm中部署了有三个实例的高可用eureka服务注册中心,本节我们讨论一下,怎么在创建一个spring cloud生产者,并用docker ...

  10. 【微信小程序】Page页面跳转(路由/返回)并传参

    页面跳转的方法参考官方文档: https://mp.weixin.qq.com/debug/wxadoc/dev/framework/app-service/route.html 问题:使用wx.na ...