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 ...
随机推荐
- 每日英语:The Toy Mogul Who Became A Billionaire Through His Fight To The Death With Barbie
The trophy case in the tiny conference room outside Isaac Larian’s corner office spans an entire wal ...
- Asp.Net微信支付接口之jsApiPay教程
1.微信支付JsApiPay只能在微信浏览器中使用 2.必须先申请微信支付功能 3.设置域名 4.设置支付授权目录 一定要精确到最后一级目录 5.获取APPID和AppSecret AppSecr ...
- 对JSON格式的城市按照拼音首字母排序
需求说明: App应用中最常见的一种操作就是对城市按照拼音首字母排序,以方便选择城市.而已有的json格式的城市数据是没有这种排序的. 已有的json格式的城市数据格式如下[简化之后]: 数据格式说明 ...
- Python提取MD5
使用Python的hashlib模块提取MD5,网上参考,觉得这个还不错,可以作为模块直接使用. # -*- coding: utf-8 -*- import hashlib import sys i ...
- python for
与其它大多数语言一样,Python 也拥有 for 循环.你到现在还未曾看到它们的唯一原因就是,Python 在其它太多的方面表现出色,通常你不需要它们. 其它大多数语言没有像 Python 一样的强 ...
- RFC 4627 JSON
Network Working Group D. Crockford Request for Comments: 4627 JSON.org Category: Informational July ...
- Kafka vs RocketMQ——多Topic对性能稳定性的影响
引言 上期我们对比了RocketMQ和Kafka在多Topic场景下,收发消息的对比测试,RocketMQ表现稳定,而Kafka的TPS在64个Topic时可以保持13万,到了128个Topic就跌至 ...
- 11月Android笔记
不知不觉又过了两个月了,过的够呛.新收获:百度云,视频直播,sqlite加密,lucene,SlidingPaneLayout. 我发现只要你有心,你期望的事情会接踵而来(不包括爱情= =) 上个游戏 ...
- 算法篇---java算法应用
算法应用之百钱买白鸡 案列说明:主要内容是:公鸡5元一只,母鸡3元一只,小鸡1元三只,问100元怎样可以买100鸡? 思想:想要实现此算法,只要明白各种条件的关系即可,而且知道公鸡最多买20只,母鸡最 ...
- java开发之发牌小程序
发牌规则 黑桃按照从小到大依次为:1-13 红桃按照从小到大依次为:14-26 梅花按照从小到大依次为:27-39 方块按照从小到大依次为:40-52 小王53 大王54 代码实现: packag ...