呼叫大牛!可惜哥以前做VC现在沦落到做java了真晕

解决方案 »

  1.   

    没弄过Jtable,,,好久没有弄Swing啦。
      

  2.   

    关于数据提交的:
    if (table.isEditing()) {  //判断是否在编辑
        int row = table.getEditingColumn();//那一行
        int col = table.getEditingColumn(); //那一列
        TableCellEditor editor = table.getCellEditor(row, col);
        editor.stopCellEditing();
    }
    不可以编辑的:
          class MyTable1Model extends DefaultTableModel {
      public MyTable1Model(Vector data,Vector columns){
    super(data,columns);
    }
    public boolean isCellEditable(int row,int column){//那一行列是否可以编辑
    return false;
    }
            public Class getColumnClass(int col) { //某一列的值的类型
          return String.class;
        }
    }
      

  3.   

    Jtable有一个bug,如果你编辑了一个cell完了之后焦点还在那个cell上,那么这个cell的值不会被更新,即使你切换到其他应用上,所以编辑完了之后要按回车或点一下其他的cell这样才会被保存
    不能设置某一列不能被编辑,需要自己写代码处理