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. OpenStack的基本概念与架构图

    https://blog.csdn.net/zjluobing/article/details/51489325 OpenStack项目是一个开源的云计算平台,旨在实现很简单,大规模可伸缩,功能丰富. ...

  2. C++技术沙龙主要内容

    5月16日技术沙龙有三场主题演讲. 第一场演讲内容:C++11 Make life easier. 第二场演讲内容:玩转编译器,让编译器给我们帮大忙. 第三场演讲内容:C++的小魔法. 精彩值得期待! ...

  3. 玩转Bootstrap(JS插件篇)-第1章 模态弹出框 :1-1导入JavaScript插件

    导入JavaScript插件 Bootstrap除了包含丰富的Web组件之外,如前面介绍的下拉菜单.按钮组.导航.分页等.他还包括一些JavaScript的插件. Bootstrap的JavaScri ...

  4. LeetCode: Partition List 解题报告

    Partition List Given a linked list and a value x, partition it such that all nodes less than x come ...

  5. Silverlight跨域访问wcf

    添加文件名为“clientaccesspolicy.xml”的文件 内容: <?xml version="1.0" encoding="utf-8"?&g ...

  6. 图解在VC里使用graphics.h画图(相似TC)

    1 www.easyx.cn 下载 EasyX 库 我下的2014;解压后例如以下图: 2 依据自己的VC 版本号进行安装 3 在控制台画一个圆 #include <graphics.h> ...

  7. ado ole方式访问access的两种方式

    OleDbConnection Connection = new OleDbConnection(); OleDbDataAdapter adapter = null; //ConnectiongSt ...

  8. C#中的volatile关键字

    volatile 关键字指示一个字段可以由多个同时执行的线程修改. 声明为 volatile 的字段不受编译器优化(假定由单个线程访问)的限制. 这样可以确保该字段在任何时间呈现的都是最新的值. vo ...

  9. C++中cin的用法汇总

    cin可以用于接收输入,最常见的是从控制台接收.在刚学习C++的时候经常会用cin来接收数据,这里想要系统的总结一下cin的用法,保证不灌水. C++中的cin是一个 istream对象,从标准输入中 ...

  10. git学习(五):git diff魔法

    不同参数下git diff输出并不相同,理解了工作区,暂存区和版本库的关系之后就很容易理解diff了. 工作区.暂存区和版本库的目录树浏览 清除工作区中未被git管理的文件 git clean -fd ...