且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在运行时更新Jtable?

更新时间:2023-12-04 14:19:28

您的data实例是Vector.在这行上,

Your data instance is a Vector. On this line,

((Vector) data.get(row)).setElementAt(value, col);

您可以使用data.get(row)从向量中获取单个元素,在您的情况下为String.现在,您正在尝试将String转换为带有(Vector)Vector,这显然是行不通的.

you fetch a single element from the vector with data.get(row), which in your case is a String. Now you are trying to convert that String into a Vector with (Vector) which obviously doesn't work.

是否要确保向量中的向量安全以生成表格?也许定义通用向量的类型将有助于您发现问题,例如Vector<Vector<String>> data.

Do you want to safe a vector in a vector to produce a table? Maybe defining the type of the generic vector will help you find your problem, e.g. Vector<Vector<String>> data.