/**
* Returns an array of all of the selected indices, in increasing
* order.
*
* @return all of the selected indices, in increasing order,
* or an empty array if nothing is selected
* @see #removeSelectionInterval
* @see #addListSelectionListener
*/
@Transient
public int[] getSelectedIndices() {
ListSelectionModel sm = getSelectionModel();
int iMin = sm.getMinSelectionIndex();
int iMax = sm.getMaxSelectionIndex();
if ((iMin < 0) || (iMax < 0)) {
return new int[0];
}
int[] rvTmp = new int[1+ (iMax - iMin)];
int n = 0;
for(int i = iMin; i <= iMax; i++) {
if (sm.isSelectedIndex(i)) {
rvTmp[n++] = i;
}
}
int[] rv = new int[n];
System.arraycopy(rvTmp, 0, rv, 0, n);
return rv;
}
JList.java 文件源码
java
阅读 30
收藏 0
点赞 0
评论 0
项目:OpenJSharp
作者:
评论列表
文章目录