the problem is at your rowData setting.You set your rowData = {null, null, null, null, null}.
As in the pre-input data, the last component is a type of boolean,
there is a conflict between the row data and the pre-input data. You should set your rowData = {null, null, null, null, false};
As in the pre-input data, the last component is a type of boolean,
there is a conflict between the row data and the pre-input data. You should set your rowData = {null, null, null, null, false};
解决方案 »
- 小算法求思路
- java基础题目
- java 二维数组的问题 急! 第一次提问。。
- 将一个整数110从右端开始的4~7位变成0。
- 如何用JDialog实现JProgressBar的功能?
- 极菜问题:怎样将byte[]转换成String ?
- 怎样设置系统和用户系统参数,一个初学者的问题!请不要奸笑。
- 救救我吧!sql问题,还有 其它 的方法实现 select top ....where(id not in (.....))的sql吗
- 请教,关于JAVA的编程工具???
- 关于StringBuffer的一个小问题,希望解答下!
- 用JTextArea显示程序运行状态的问题
- 包的使用: page mypage does not exist
rowData = {null, null, null, null, new Boolean(false)};
很显然是这句话惹的祸,在你的代码里getColumnClass(0)取出来的是第0行第0列的数据的类型,明显是String,所以你只是为String类型加载了一个默认的Renderer,而你Insert以后,第0行第0列是null,它的类型不是String,所以Renderer被重载成系统默认的Renderer,你的Renderer自然就不生效了,要解决问题可以把上面的代码换成:
getColumnModel().getColumn(0).setCellRenderer(new CustomRowHeaderRenderer());
或者你
Object[][] data = {
{ "Mary", "Campione", "Snowboarding", new Integer(5),
new Boolean(false) },
{ "Alison", "Huml", "Rowing", new Integer(3), new Boolean(true) },
{ "Kathy", "Walrath", "Knitting", new Integer(2),
new Boolean(false) },
{ "Sharon", "Zakhour", "Speed reading", new Integer(20),
new Boolean(true) },
{ "Philip", "Milne", "Pool", new Integer(10), new Boolean(false) } };
里面的第一个"Mary"写成null也行,呵呵,不过估计这不是你想要的,开个玩笑 ^_^