e780. 设置JList中的已选项
List selection events are fired when the following methods are used to change the set of selected items (see e774 创建JList组件).
// Create a list and get the model
String[] items = {"A", "B", "C", "D"};
JList list = new JList(items); // Select the second item
int start = 1;
int end = 1;
list.setSelectionInterval(start, end); // B // Select the first 3 items
start = 0;
end = 2;
list.setSelectionInterval(start, end); // A, B, C // Select all the items
start = 0;
end = list.getModel().getSize()-1;
if (end >= 0) {
list.setSelectionInterval(start, end); // A, B, C, D
} // Clear all selections
list.clearSelection(); // Select the first item
start = 0;
end = 0;
list.setSelectionInterval(start, end); // A // Add another selection - the third item
start = 2;
end = 2;
list.addSelectionInterval(start, end); // A, C // Deselect the first item
start = 0;
end = 0;
list.removeSelectionInterval(start, end); // C // Select a single item
boolean scrollIntoView = true;
list.setSelectedValue("B", scrollIntoView); // B
| Related Examples |
e780. 设置JList中的已选项的更多相关文章
- e779. 获得JList中的已选项
The following methods return the indices of the selected items: // To create a list, see e774 创建JLis ...
- e781. 设置JList中的选择模式
// The default mode is MULTIPLE_INTERVAL_SELECTION String[] items = {"A", "B", & ...
- 【MyEclipse优化】-----如何合理设置MyEclipse中的validation选项
打开eclipse,点击[window]菜单,选择[preferences]选项. 在左侧点击[validation]选项,在右侧可以看到eclipse进行的自动检查都有哪些内容. 将Manual(手 ...
- MyEclipse优化】-----如何合理设置MyEclipse中的validation选项
打开eclipse,点击[window]菜单,选择[preferences]选项. 在左侧点击[validation]选项,在右侧可以看到eclipse进行的自动检查都有哪些内容. 将Manual(手 ...
- Bash中的shopt选项
Bash中的shopt选项 http://blog.chinaunix.net/uid-20587169-id-1919110.html shopt命令用于显示和设置shell中的行为选项,通过这些选 ...
- windows7下系统保护中出现错误“文件名、目录名或卷标语法不正确。(0x8007007B)“ 以及保护设置列表中出现“Windows7_os(c:)(找不到)”选项时的解决方法
windows7下系统保护功能很是鸡肋,有事会出现一下两个问题: 1.出现错误“文件名.目录名或卷标语法不正确.(0x8007007B) 2.保护设置列表中出现“Windows7_os(c:)(找不到 ...
- vue table中使用多选的问题(翻页后如何保存已选项),联动echarts图表实现流量监控
流量监控项目需求: 根据表格数据,添加多选功能,默认全选,根据已选项更新图表视图 1.表格需要多选 2.要联动图表,所以关键是要利用表格多选的触发回调函数 vue table中使用多选: 很简单,只需 ...
- Linux: 介绍make menuconfig中的每个选项含义【转】
转自:http://blog.csdn.net/gaoyuanlinkconcept/article/details/8810468 介绍make menuconfig中的每个选项含义 Linux 2 ...
- 修改 /var/lib/locales/supported.d/local 文件(使用 locale -a 命令查看系统中所有已配置的 locale)
转自:http://zyxhome.org/wp/cc-prog-lang/c-stdlib-setlocale-usage-note/ http://www.west263.com/info/htm ...
随机推荐
- 未能为数据库 '*'中得对象'*'分配空间,因文件组'PRIMARY'已满
服务器使用mssqlserver2005,最近经常出现无法新增信息错误,查看日志,发现严重错误提示,内容大致为: 无法为数据库 'weixin_main' 中的对象 'dbo.wx_logs'.'PK ...
- 【DIOCP开源项目】实际应用案例
案例1 DIOCP是Delphi下进行IOCP服务端通讯开发的一个非常好的开源框架,稳定.高效并且使用起来十分简单. 自己两个多月之前因为需要使用Delphi开发一个TCP服务端,当时也是到处爬文,希 ...
- EntityFramework安装和EF升级方法
例如:如何在vs2010上安装EntityFramework5.0? 首先,需要安装一个vs插件,名称为NuGet Package Manager,微软官方发布的,其作用就是为vs工程项目自动下载.安 ...
- 玩转Bootstrap(JS插件篇)-第1章 模态弹出框 :1-1导入JavaScript插件
导入JavaScript插件 Bootstrap除了包含丰富的Web组件之外,如前面介绍的下拉菜单.按钮组.导航.分页等.他还包括一些JavaScript的插件. Bootstrap的JavaScri ...
- 使用instantclient_11_2和pl/sql Developer连接oracle远程数据库
https://blog.csdn.net/itmyhome1990/article/details/8796781 ***************************************** ...
- java中的数据结构[copy]
转自http://developer.51cto.com/art/201107/273003.htm java版数据结构与算法,希望对你有帮助. 线性表,链表,哈希表是常用的数据结构,在进行Java开 ...
- java 多线程 30: 多线程组件之 CyclicBarrier
CyclicBarrier 接着讲多线程下的其他组件,第一个要讲的就是CyclicBarrier.CyclicBarrier从字面理解是指循环屏障,它可以协同多个线程,让多个线程在这个屏障前等待,直到 ...
- 4. 集成学习(Ensemble Learning)Adaboost
1. 集成学习(Ensemble Learning)原理 2. 集成学习(Ensemble Learning)Bagging 3. 集成学习(Ensemble Learning)随机森林(Random ...
- MVC3中输出Html标签的方法
想要输出html,可以三种方式:@Html.Raw(a)@MvcHtmlString.Create(a)@{WriteLiteral(a);} @(new HtmlString( "< ...
- Android 面试知识集2
继续上一篇文章整理有关Android的基础知识,为面试做准备的可以看看哪些知识是遗漏了.资料都是网上整理来,纠正了一些错误,有部分解析加入个人理解!感谢分享相关知识的开发者.这些知识平常开发的过程中都 ...