资源简介
代码片段和文件信息
/*******************************************************************************
* Copyright (c) 2011 Google Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Google Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.wb.swing;
import java.awt.Component;
import java.awt.Container;
import java.awt.FocusTraversalPolicy;
/**
* Cyclic focus traversal policy based on array of components.
*
* This class may be freely distributed as part of any application or plugin.
*
* @author scheglov_ke
*/
public class FocusTraversalOnArray extends FocusTraversalPolicy {
private final Component m_Components[];
////////////////////////////////////////////////////////////////////////////
//
// Constructor
//
////////////////////////////////////////////////////////////////////////////
public FocusTraversalOnArray(Component components[]) {
m_Components = components;
}
////////////////////////////////////////////////////////////////////////////
//
// Utilities
//
////////////////////////////////////////////////////////////////////////////
private int indexCycle(int index int delta) {
int size = m_Components.length;
int next = (index + delta + size) % size;
return next;
}
private Component cycle(Component currentComponent int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
}
}
// try to find enabled component in “delta“ direction
int initialIndex = index;
while (true) {
int newIndex = indexCycle(index delta);
if (newIndex == initialIndex) {
break;
}
index = newIndex;
//
Component component = m_Components[newIndex];
if (component.isEnabled() && component.isVisible() && component.isFocusable()) {
return component;
}
}
// not found
return currentComponent;
}
////////////////////////////////////////////////////////////////////////////
//
// FocusTraversalPolicy
//
////////////////////////////////////////////////////////////////////////////
public Component getComponentAfter(Container container Component component) {
return cycle(component 1);
}
public Component getComponentBefore(Container container Component component) {
return cycle(component -1);
}
public Component getFirstComponent(Container container) {
return m_Components[0];
}
public Component getLastComponent(Container container) {
return m_Components[m_Components.length - 1];
}
public Component getDefaultComponent(Container container) {
return getFirstComponent(contain
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-07-30 15:35 yan0603\
文件 614 2017-06-05 08:10 yan0603\.classpath
文件 383 2017-06-03 15:09 yan0603\.project
目录 0 2018-07-30 15:35 yan0603\.settings\
文件 598 2017-06-03 15:09 yan0603\.settings\org.eclipse.jdt.core.prefs
文件 932 2017-06-08 15:40 yan0603\BackgroundImage.jar
目录 0 2018-07-30 15:35 yan0603\bin\
目录 0 2018-07-30 15:35 yan0603\bin\org\
目录 0 2018-07-30 15:35 yan0603\bin\org\eclipse\
目录 0 2018-07-30 15:35 yan0603\bin\org\eclipse\wb\
目录 0 2018-07-30 15:35 yan0603\bin\org\eclipse\wb\swing\
文件 1988 2017-06-08 15:59 yan0603\bin\org\eclipse\wb\swing\FocusTraversalOnArray.class
目录 0 2018-07-30 15:35 yan0603\bin\yan0603\
文件 607 2017-06-12 10:43 yan0603\bin\yan0603\Login$1.class
文件 7015 2017-06-12 10:43 yan0603\bin\yan0603\Login.class
文件 625 2017-06-11 08:42 yan0603\bin\yan0603\Register$1.class
文件 6582 2017-06-11 08:42 yan0603\bin\yan0603\Register.class
文件 3553 2017-06-10 16:40 yan0603\bin\yan0603\Select.class
文件 789 2017-06-09 11:26 yan0603\bin\yan0603\Vote$1.class
文件 3595 2017-06-09 11:26 yan0603\bin\yan0603\Vote$MyActionListener.class
文件 9069 2017-06-09 11:26 yan0603\bin\yan0603\Vote.class
文件 7753 2017-06-09 11:26 yan0603\bin\yan0603\VoteBuy.class
文件 81600 2017-06-03 21:58 yan0603\jgoodies-common-1.8.0-sources.jar
文件 44882 2017-06-03 21:58 yan0603\jgoodies-common-1.8.0.jar
文件 174206 2017-06-03 21:58 yan0603\jgoodies-forms-1.8.0-sources.jar
文件 131647 2017-06-03 21:58 yan0603\jgoodies-forms-1.8.0.jar
目录 0 2018-07-30 15:35 yan0603\src\
目录 0 2018-07-30 15:35 yan0603\src\org\
目录 0 2018-07-30 15:35 yan0603\src\org\eclipse\
目录 0 2018-07-30 15:35 yan0603\src\org\eclipse\wb\
目录 0 2018-07-30 15:35 yan0603\src\org\eclipse\wb\swing\
............此处省略10个文件信息
相关资源
- 基于java开发的公交信息管理系统
- 详解docker镜像centos7配置Java运行环境
- java笔试题大全java笔试,面试笔试,逻
- Windows bat 设置Java环境变量
- java 毕业设计 进销存管理系统 源码
- java图片浏览器跨平台运行程序与源码
- 基于java的在线考试系统-毕业设计
- 微博系统(Java源码,servlet+jsp),适
- java串口通信全套完整代码-导入eclip
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- 商店商品管理系统 JAVA写的 有界面
川公网安备 51152502000135号
评论
共有 条评论