当前位置: 技术问答>java相关
有谁知道将JTable设为只读的函数?
来源: 互联网 发布时间:2015-02-15
本文导语: 有谁知道将JTable对象设为只读的函数? | 试试下面的方法,看jtable能不能写. Vector vdata_ration = new Vector(); Vector vname_ration = new Vector(); vname_ration.add("column1"); vname_ration.add("column2"); vdata_ration....
有谁知道将JTable对象设为只读的函数?
|
试试下面的方法,看jtable能不能写.
Vector vdata_ration = new Vector();
Vector vname_ration = new Vector();
vname_ration.add("column1");
vname_ration.add("column2");
vdata_ration.add(vname_ration);
ETableModel model_ration = new ETableModel(vdata_ration, vname_ration);
public class ETableModel extends DefaultTableModel {
public boolean[][] ColEditableVec;
public int row = 0;
public int column = 0;
public Vector new_vdata;
public ETableModel(Vector vdata,Vector vname) {
super(vdata,vname);
setNumRows(vdata.size());
row = vdata.size();
column = vname.size();
new_vdata = vdata;
ColEditableVec = new boolean[row][column];
for(int i=0;i
Vector vdata_ration = new Vector();
Vector vname_ration = new Vector();
vname_ration.add("column1");
vname_ration.add("column2");
vdata_ration.add(vname_ration);
ETableModel model_ration = new ETableModel(vdata_ration, vname_ration);
public class ETableModel extends DefaultTableModel {
public boolean[][] ColEditableVec;
public int row = 0;
public int column = 0;
public Vector new_vdata;
public ETableModel(Vector vdata,Vector vname) {
super(vdata,vname);
setNumRows(vdata.size());
row = vdata.size();
column = vname.size();
new_vdata = vdata;
ColEditableVec = new boolean[row][column];
for(int i=0;i