当前位置: 首页>>代码示例>>Java>>正文


Java ListSelectionModel.setSelectionInterval方法代码示例

本文整理汇总了Java中javax.swing.ListSelectionModel.setSelectionInterval方法的典型用法代码示例。如果您正苦于以下问题:Java ListSelectionModel.setSelectionInterval方法的具体用法?Java ListSelectionModel.setSelectionInterval怎么用?Java ListSelectionModel.setSelectionInterval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.ListSelectionModel的用法示例。


在下文中一共展示了ListSelectionModel.setSelectionInterval方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showNextSelection

import javax.swing.ListSelectionModel; //导入方法依赖的package包/类
void showNextSelection(boolean forward) {
    int selectedRow = this.getSelectedRow();
    int lastRowIndex = this.getRowCount() - 1;
    ListSelectionModel selection = this.getSelectionModel();
    int toSelect;
    if (forward) {
        toSelect = selectedRow + 1;
    } else {
        toSelect = selectedRow - 1;
    }
    if (toSelect < 0) {
        toSelect = lastRowIndex;
    } else if (toSelect > lastRowIndex) {
        toSelect = 0;
    }
    selection.setSelectionInterval(toSelect, toSelect);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:NotificationTable.java

示例2: onUpClick

import javax.swing.ListSelectionModel; //导入方法依赖的package包/类
private void onUpClick() {
    ListSelectionModel listSelectionModel = getSelectionModel();
    int r = listSelectionModel.getMinSelectionIndex();        
    if(r > 0) {
        DefaultTableModel model = getModel();
        int rNew = r - 1;
        model.moveRow(r, r, rNew) ;
        listSelectionModel.setSelectionInterval(rNew, rNew);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:AnnotationSettings.java

示例3: onDownClick

import javax.swing.ListSelectionModel; //导入方法依赖的package包/类
private void onDownClick() {
    ListSelectionModel listSelectionModel = getSelectionModel();
    int r = listSelectionModel.getMinSelectionIndex();                
    DefaultTableModel model = getModel();
    if(r > -1 && r < model.getRowCount() - 1) {     
       int rNew = r + 1;
       model.moveRow(r, r, rNew) ;
       listSelectionModel.setSelectionInterval(rNew, rNew);
    }        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:AnnotationSettings.java

示例4: onRemoveClick

import javax.swing.ListSelectionModel; //导入方法依赖的package包/类
private void onRemoveClick() {        
    ListSelectionModel selectionModel = getSelectionModel();
    int r = selectionModel.getMinSelectionIndex();
    if(r > -1) {
        getModel().removeRow(r);
    }
    int size = getModel().getRowCount();
    if(size > 0) {            
        if (r > size - 1) {
            r = size - 1;
        } 
        selectionModel.setSelectionInterval(r, r);    
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:AnnotationSettings.java


注:本文中的javax.swing.ListSelectionModel.setSelectionInterval方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。