楼主 admin 发表于2014-9-23 11:28:27
Boolean单元格支持附加文本

奇新Java电子表格Boolean类型的Checkbox单元格支持附加文本(这个是v3.6 Beta16添加的新功能,在群文件或者下载专区中下载):

设置的代码如下:

 

        
        model.setColumnClass(Boolean.class, 4);
        dataGrid.setCellEditorComponentTypeByColumn(4, CellEditorComponentType.CHECK_BOX);
        dataGrid.setCellRendererComponentTypeByColumn(4, CellRendererComponentType.CHECK_BOX);
        a = new SimpleAttributeSet();
        CellStyle.setDisplayValue(a, "hello");
        model.setCellAttributes(a, 0, 4);
        a = new SimpleAttributeSet();
        CellStyle.setDisplayValue(a, "world");
        model.setCellAttributes(a, 1, 4);
        a = new SimpleAttributeSet();
        CellStyle.setDisplayValue(a, "hello, world");
        model.setCellAttributes(a, 2, 4);