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 ...
随机推荐
- Linux 移动或重命名文件/目录-mv 的10个实用例子
本文导航 -初识 mv 命令03% -1.移动文件08% -2.移动多个文件15% -3.移动目录23% -4.重命名文件或目录27% -5. 重命名目录35% -6. 打印移动信息39% -7. 使 ...
- Tornado使用-队列Queue
1.tornado队列的特点 和python标准队列queue相比,tornado的队列Queue支持异步 2.Queue常用方法 Queue.get() 会暂停,直到queue中有元素 Queue. ...
- js判断浏览器内核和版本(包括手机端设备)
var X, xue;xue = xue || function(expr, fn) { return xue.dom ? xue.dom(expr, fn) : {};};X = xue;wi ...
- zabbix_agentd在windows上安装
zabbix_agentd在Windows环境内客户端的安装与管理 1) 在目标机器上C:\windows目录下新建一个目录,如zabbix_agent: 2) 将zabbix_agent软件 ...
- S3C2440时钟体系结构
任意一款单板,我们了解其时钟都是通过时钟树来的. 这里没有全部截完,只是讲解时钟来源,OSC代表晶振,这说明我们的时钟可以来至晶振OSC也可以来至外部输入EXTCLK,这是通过OM选择器来完成的. 2 ...
- easyui扩展
datagrid行内编辑时为datetimebox $.extend($.fn.datagrid.defaults.editors, { datetimebox: {// datetimebox就是你 ...
- Android开发(六)——组件颜色Selector(Selector与Shape的基本用法 )
andorid控件改变状态时改变颜色,使用selector. <?xml version="1.0" encoding="utf-8" ?> < ...
- C# 跳转新页面
C# 跳转新页面 string url = "http://www.vipsoft.com.cn"; ResponseRedirect.Redirect(Response, url ...
- Kafka vs RocketMQ—— Topic数量对单机性能的影响
引言 上一期我们对比了三类消息产品(Kafka.RabbitMQ.RocketMQ)单纯发送小消息的性能,受到了程序猿们的广泛关注,其中大家对这种单纯的发送场景感到并不过瘾,因为没有任何一个网站的业务 ...
- IOS修改Navigation Bar上的返回按钮文本颜色,箭头颜色以及导航栏按钮的颜色
自从IOS7后UINavigationBar的一些属性的行为发生了变化.你可以在下图看到: 现在,如果你要修改它们的颜色,用下面的代码: 1 2 3 4 self.navigationControll ...