e779. 获得JList中的已选项
The following methods return the indices of the selected items:
// To create a list, see e774 创建JList组件 // Get the index of all the selected items
int[] selectedIx = list.getSelectedIndices(); // Get all the selected items using the indices
for (int i=0; i<selectedIx.length; i++) {
Object sel = list.getModel().getElementAt(selectedIx[i]);
} // Get the index of the first selected item
int firstSelIx = list.getSelectedIndex(); // Get the index of the last selected item
int lastSelIx = list.getMaxSelectionIndex(); // Determine if the third item is selected
int index = 2;
boolean isSel = list.isSelectedIndex(index); // Determine if there are any selected items
boolean anySelected = !list.isSelectionEmpty();
The following methods return the selected item objects:
// Get the first selected item
Object firstSel = list.getSelectedValue(); // Get all selected items without using indices
Object[] selected = list.getSelectedValues();
Related Examples |
e779. 获得JList中的已选项的更多相关文章
- e780. 设置JList中的已选项
List selection events are fired when the following methods are used to change the set of selected it ...
- vue table中使用多选的问题(翻页后如何保存已选项),联动echarts图表实现流量监控
流量监控项目需求: 根据表格数据,添加多选功能,默认全选,根据已选项更新图表视图 1.表格需要多选 2.要联动图表,所以关键是要利用表格多选的触发回调函数 vue table中使用多选: 很简单,只需 ...
- OJ提交题目中的语言选项里G++与C++的区别(转)
G++? 首先更正一个概念,C++是一门计算机编程语言,G++不是语言,是一款编译器中编译C++程序的命令而已. 那么他们之间的区别是什么? 在提交题目中的语言选项里,G++和C++都代表编译的方式. ...
- OJ提交题目中的语言选项里G++与C++的区别(转载)
原文链接:http://blog.polossk.com/201405/c-plus-plus-g-plus-plus G++? 首先更正一个概念,C++是一门计算机编程语言,G++不是语言,是一款编 ...
- Linux: 介绍make menuconfig中的每个选项含义【转】
转自:http://blog.csdn.net/gaoyuanlinkconcept/article/details/8810468 介绍make menuconfig中的每个选项含义 Linux 2 ...
- 【转】OJ提交题目中的语言选项里G++与C++的区别
原文链接:http://blog.polossk.com/201405/c-plus-plus-g-plus-plus G++? 首先更正一个概念,C++是一门计算机编程语言,G++不是语言,是一款编 ...
- 修改 /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 ...
- OJ提交题目中的语言选项里G++与C++的区别
一.OJ提交题目中的语言选项里G++与C++的区别 http://www.th7.cn/Program/cp/201405/199001.shtml 首先更正一个概念,C++是一门计算机编程语言,G+ ...
- ubuntu中查看已安装软件包的方法
ubuntu中查看已安装软件包的方法: 方法一:在新立得软件包管理器中,打到已安装,便可以看看有多少包被安装. 如果想把这些包的信息复制到一文件里,可用下面的方法. 方法二:在终端输入 sudo dp ...
随机推荐
- Java 虚拟机类加载器
虚拟机设计团队把类加载阶段张的”通过一个类的全限定名来获取此类的二进制字节流”这个动作放到Java虚拟机外部去实现,以便让应用程序自己决定如何去获取所需要的类.实现这个动作的代码模块称为”类加载器”. ...
- javascript基础拾遗(二)
1.对象定义 定义属性 var language = { name:'javascript', score:9.0 }; console.log(language.name) console.log( ...
- Kafka: Producer (0.10.0.0)
转自:http://www.cnblogs.com/f1194361820/p/6048429.html 通过前面的架构简述,知道了Producer是用来产生消息记录,并将消息以异步的方式发送给指定的 ...
- sql2008修改数据库文件名称
例如我们有数据库a,需修改成b,包括文件名称也修改 1.备份数据a 选择数据库->右键->任务->备份,备份出a.bak 2.右键->任务->还原->数据库,跳出“ ...
- OSSIM架构与组成综述
OSSIM布道师 李晨光 一.背景 如果运维工程师手里没有高效的管理工具支持,就很难快速处理故障.市面上有很多运维监控工具,例如商业版的 Solarwinds.ManageEngine以及WhatsU ...
- STM32内部flash存储小数——别样的C语言技巧
今天在进行STM32内部falsh存储的时候,发现固件库历程的函数原型是这样的: 第一个是地址,在我的STM32中是2K一页的,第二个是要写入的数据. 问题就来了,存储一个小数该怎么办呢?固件库给的是 ...
- django源码解析之 BooleanField (三)
def __init__(self, *args, **kwargs): kwargs['blank'] = True if 'default' not in kwargs and not kwarg ...
- [转]快速搞懂Gson的用法
原文地址:http://coladesign.cn/fast-understand-the-usage-of-gson/ 谷歌gson这个Java类库可以把Java对象转换成JSON,也可以把JSON ...
- C语言 · 陶陶摘苹果2
算法提高 陶陶摘苹果2 时间限制:1.0s 内存限制:256.0MB 问题描述 陶陶家的院子里有一棵苹果树,每到秋天树上就会结出n个苹果.苹果成熟的时候,陶陶就会跑去摘苹果.陶陶有个 ...
- C++中嵌入python程序——命令行模式
http://blog.csdn.net/yiyouxian/article/details/51992721