Advertisement

JTable在C列中设置为可勾选

阅读量:

1,MyTableModel 类对 DefaultTableModel 类进行继承,并在此基础上新增了以下功能:

复制代码
    成员变量
    Class[] typeArray = {Object.class,Object.class,Object.class,Object.class, Object.class, Boolean.class};
    
    
复制代码
    方法
    public void selectAllOrNull(boolean value){
      // Select All. The last column
     	for(int index = 0; index < getRowCount(); index ++){
        this.setValueAt(value, index, 5);
    }
    }
    	
    public Class getColumnClass(int columnIndex) {  
       return typeArray[columnIndex];// 返回每一列的数据类型   
    }
    

全部评论 (0)

还没有任何评论哟~