setValueAt
public void setValueAt(Object aValue,
                       int row,
                       int column)Sets the value for the cell in the table model at row and column. 
Note: The column is specified in the table view's display order, and not in the TableModel's column order. This is an important distinction because as the user rearranges the columns in the table, the column at a given index in the view will change. Meanwhile the user's actions never affect the model's column ordering. aValue is the new value. 
Parameters:
aValue - the new value
row - the row of the cell to be changed
column - the column of the cell to be changed
See Also:
getValueAt(int, int)

解决方案 »

  1.   

    清楚吗?aValue将被调用.toString()方法,所以String就不用了
      

  2.   

    to  mercury1231
    String oo;
    oo = "asdfsd";
    JTable.setValueAt(oo, 1, 2);
    这样写提示错误。这是为什么?
      

  3.   

    JTable.setValueAt(oo, 1, 2);
    ---------
    JTable 表示什么,类名?还是实例名称?
    这样都不合适,如果是实例名称,就用了关键字!是类名,就错误。
      

  4.   

    不太清楚你的错误是什么,最好把错误贴出来进一步看看。不过你先看一下有可能是gotoidea(索欣)说的错误吗?如果是,那可太不小心了。另外小心你set的单元格超出了范围,呵呵
      

  5.   

    其实就是如果我想改变JTable的某个单元格的值该怎么做?将一个String类型的值赋给指定的单元格
      

  6.   

    String oo=new String();
    oo = "asdfsd";
    JTable.setValueAt(oo, 1, 2);
    应该这样。