添加新行.在Java中删除Jtable的多行 [英] Add new row.Delete multi row of Jtable in Java
本文介绍了添加新行.在Java中删除Jtable的多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我有一个需要任何人帮助的问题.
我有一个Jtable数据,现在我想添加新行或删除一行或多行,
当我添加新内容时,未添加屏幕上的数据,但是当我单击任意单元格并对其进行编辑时,会出现新行,当我调试代码时,在命令Add.Message错误中看到了异常.错误消息"ArrayIndexOutofBoundException"
Hi all,
I have a problem that need anyone help.
I hava a Jtable data and now I want to add new row or delete a row or multi row,
when I add new,data on screen is not added but when I click on anycell and edit them, new row is appear,when I debug code, i saw exception at command Add.Message Error "ArrayIndexOutofBoundException"
Vector<Object> obj = new Vector<Object>("","","","","","");
obj.set(0, dataTable.getRowCount()+ 1);
model = (M6VariableTableModel) dataTable.getModel();
model.addRow(obj);
对于Delete te same.
请帮帮我!
and for Delete te same.
please help me!
thanks in advance!
推荐答案
检查以下链接:
http://www.exampledepot.com/egs/javax.swing.table/AppendRow.html [^ ]
http://www.exampledepot.com/egs/javax.swing.table/InsertRow.html [^ ]
似乎addRow
可能与Vector
Check the following links :
http://www.exampledepot.com/egs/javax.swing.table/AppendRow.html[^]
http://www.exampledepot.com/egs/javax.swing.table/InsertRow.html[^]
It seems thataddRow
may have problems with aVector
这篇关于添加新行.在Java中删除Jtable的多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文