e615. Finding the Next Focusable Component
public Component findNextFocus() {
// Find focus owner
Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
Container root = c == null ? null : c.getFocusCycleRootAncestor();
if (root != null) {
FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
Component nextFocus = policy.getComponentAfter(root, c);
if (nextFocus == null) {
nextFocus = policy.getDefaultComponent(root);
}
return nextFocus;
}
return null;
}
public Component findPrevFocus() {
// Find focus owner
Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
Container root = c == null ? null : c.getFocusCycleRootAncestor();
if (root != null) {
FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
Component prevFocus = policy.getComponentBefore(root, c);
if (prevFocus == null) {
prevFocus = policy.getDefaultComponent(root);
}
return prevFocus;
}
return null;
}
| Related Examples |
e615. Finding the Next Focusable Component的更多相关文章
- e612. Moving the Focus to the Next or Previous Focusable Component
The methods to move the focus to the next or to the previous focusable component are Component.trans ...
- UE4 Tutorial - Custom Mesh Component 用于绘制自定义网格的插件CustomMeshComponent
UE4 中用于绘制自定义网格的插件CustomMeshComponent. 转载: UE4 Tutorial - Custom Mesh Component Over the last few w ...
- 另一鲜为人知的单例写法-ThreadLocal
另一鲜为人知的单例写法-ThreadLocal 源代码范例 当我阅读FocusFinder和Choreographer的时候,我发现这两类的单例实现和我们寻经常使用双重检查锁非常不一样.而是用来一个T ...
- Extjs4.x (MVC)Controller中refs以及Ext.ComponentQuery解析
refs : Object[]5 Array of configs to build up references to views on page. For example: Ext.define(& ...
- 阻尼滑动--能够滑动过度的ScrollView(OverScrollView)
贴上一个我自己用过的阻尼滑动的ScrollView,像QQ里面那种滑动效果,尽管不是我写的,可是我认为还能够,贴出来做个记录,实用到的时候免得到处去找. 代码例如以下: /* * Copyright ...
- Android 继承framelayout,实现ScrollView 和 HorizontalScrollView 的效果
有些项目,需要让控件或者布局进行水平和垂直同时能拖拽,当然,ScrollView 和 HorizontalScrollView 的结合写法是一种写法.但是,这么写用户体验效果不佳,会有迟钝感,因此推荐 ...
- Android--ScrollView边界回弹效果
/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Versi ...
- 谈谈Ext JS的组件——组件基类:Ext.Component
概述 Ext.Component是所有Ext组件的基类,这在Ext.Component的API中第一句话就提到了.然后第二段说明了它包含的基本功能:隐藏/显示.启用/禁用以及尺寸控制等.除了以上这些基 ...
- Steps to Resolve the Database JAVAVM Component if it Becomes INVALID After Applying an OJVM Patch
11.2.0.2升级到11.2.0.4 memory_target 设置过小,只有800M. 导致jserver jave virtual machine 组件无法安装, 建议升级之前至少memory ...
随机推荐
- linux命令(37):paste,合并两个文件,对应行为一行
paste的格式为: paste -d -s -file1 file2 选项的含义如下: -d 指定不同于空格或t a b键的域分隔符.例如用@分隔域,使用- d @.如果不指定,默认用空格分割 -s ...
- Python:sitecustomize 和 usercustomize
Python提供了两个hook用于定制Python:sitecustomize 和 usercustomize,首先需要查看site包目录, 然后就可以在此目录下创建usercustomize.py文 ...
- Android 编程下通过 Theme 和 Style 避免 APP 启动闪黑屏
之前在做 APP 的时候不太关注这个问题,因为自己在使用其他 APP 的时候也会在应用启动的初始有一个黑屏闪过后才会出现应用的欢迎页.直到最近开发过程中发现自己在欢迎页启动的线程由于请求和处理的数据量 ...
- 使用canvas绘制扇形图
<!doctype html><html lang="en"><head> <meta charset="UTF-8" ...
- H3C交换机SNMP配置
1.启动/关闭SNMP Agent服务 在系统视图模式下: 启用:snmp-agent 关闭:undo snmp-agent 注:缺省情况下snmp agent是关闭的 2. 使能或禁止SNMP相应版 ...
- Python3求英文文档中每个单词出现的次数并排序
[本文出自天外归云的博客园] 题目要求: 1.统计英文文档中每个单词出现的次数. 2.统计结果先按次数降序排序,再按单词首字母降序排序. 3.需要考虑大文件的读取. 我的解法如下: import ch ...
- ARKit从入门到精通(7)-ARCamera介绍
ARCamera是一个相机,它是连接虚拟场景与现实场景之间的枢纽.在ARKit中,它是捕捉现实图像的相机,在SceneKit中它又是3D虚拟世界中的相机.(一般第一人称3D游戏,主角其实就是一个3D相 ...
- git拉取远程分支
查看本地所有分支列表: git branch -a 查看远程所有分支列表: git branch -r 拉取远程分支(使用该方式会在本地新建分支x,但是不会自动切换到该本地分支x,需要手动checko ...
- 使用Task代替ThreadPool和Thread
转载:改善C#程序的建议9:使用Task代替ThreadPool和Thread 一:Task的优势 ThreadPool相比Thread来说具备了很多优势,但是ThreadPool却又存在一些使用上的 ...
- linux异步IO--aio
简述 linux下异步方式有两种:异步通知和异步IO(AIO),异步通知请参考:linux异步通知 Linux的I/O机制经历了一下几个阶段的演进: 1. 同步阻塞I/O: 用户进程进行I/O操作,一 ...