javax.swing.ListSelectionModel#removeSelectionInterval ( )源码实例Demo

下面列出了javax.swing.ListSelectionModel#removeSelectionInterval ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Bytecoder   文件: SwingUtilities2.java
/**
 * Set the lead and anchor without affecting selection.
 */
public static void setLeadAnchorWithoutSelection(ListSelectionModel model,
                                                 int lead, int anchor) {
    if (anchor == -1) {
        anchor = lead;
    }
    if (lead == -1) {
        model.setAnchorSelectionIndex(-1);
        model.setLeadSelectionIndex(-1);
    } else {
        if (model.isSelectedIndex(lead)) {
            model.addSelectionInterval(lead, lead);
        } else {
            model.removeSelectionInterval(lead, lead);
        }
        model.setAnchorSelectionIndex(anchor);
    }
}
 
源代码2 项目: wandora   文件: AnySelectionTable.java
public void invertSelection() {
    if(tableSelectionModel != null) {
        int colCount = this.getColumnCount();
        int rowCount = this.getRowCount();
        for(int c=0; c<colCount; c++) {
            ListSelectionModel columnSelectionModel = tableSelectionModel.getListSelectionModelAt(c);
            if(columnSelectionModel != null) {
                for(int r=0; r<rowCount; r++) {
                    if(columnSelectionModel.isSelectedIndex(r)) {
                        columnSelectionModel.removeSelectionInterval(r, r);
                    }
                    else {
                        columnSelectionModel.addSelectionInterval(r, r);
                    }
                }
            }
        }
    }
    this.repaint();
}
 
源代码3 项目: BigStitcher   文件: TranslateGroupManuallyPopup.java
public static void reSelect(final ListSelectionModel lsm)
{
	final int maxSelectionIndex = lsm.getMaxSelectionIndex();
	for (int i = 0; i <= maxSelectionIndex; i++)
		if (lsm.isSelectedIndex( i ))
		{
			lsm.removeSelectionInterval( i, i );
			lsm.addSelectionInterval( i, i );
		}
}
 
源代码4 项目: wandora   文件: AnySelectionTable.java
public void deselectColumn(int column) {
    int rowCount = this.getRowCount();
    int colCount = this.getColumnCount();
    if(tableSelectionModel != null && column < colCount) {
        ListSelectionModel columnSelectionModel = tableSelectionModel.getListSelectionModelAt(column);
        if(columnSelectionModel != null) {
            columnSelectionModel.removeSelectionInterval(0, rowCount-1);
        }
    }
    this.repaint();
}
 
源代码5 项目: wandora   文件: AnySelectionTable.java
public void deselectRow(int row) {
    int colCount = this.getColumnCount();
    int rowCount = this.getRowCount();
    if(tableSelectionModel != null && row < rowCount) {
        ListSelectionModel columnSelectionModel = null;
        for(int c=0; c<colCount; c++) {
            columnSelectionModel = tableSelectionModel.getListSelectionModelAt(c);
            if(columnSelectionModel != null) {
                columnSelectionModel.removeSelectionInterval(row, row);
            }
        }
    }
    this.repaint();
}
 
源代码6 项目: wandora   文件: TableSelectionModel.java
/**
* Forwards the request to the ListSelectionModel
* at the specified column.
*/
public void removeSelection(int row, int column) {
    ListSelectionModel lsm = getListSelectionModelAt(column);
    lsm.removeSelectionInterval(row, row);
}