📄 tablemodel1.java
字号:
package net.aetherial.gis.surface.design.cun;
import javax.swing.table.AbstractTableModel;
import net.aetherial.gis.surface.ItemValue;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import net.aetherial.gis.table.WuWei;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class TableModel1 extends AbstractTableModel{
public TableModel1() {
}
private boolean dataEdit = true;
private String[] columnNames = {"乡镇","行政村","面积","自然村","地形","是否有条件通公路","是否建有渡口","人口","人均收入","经济活动","备注"};
private Object[][] data = {{"","","","","","","","","","",""}};//same as before...
public void getdata(){
}
public Object[] getRow(int row){
return data[row];
}
public void setData(Object[] row){
this.data[0] = row;
}
private void printData(){
if (this.data != null) {
for (int i = 0; i < data.length; i++) {
System.out.println("data["+i+"]"+data[i][0] + "," + data[i][0] + "," + data[i][0] + "," + data[i][0] + "," + data[i][0]);
}
}else{
System.out.println("data == null!");
}
}
public void setDataEdited(){
this.dataEdit = true;
}
public boolean getDataEdit(){
return this.dataEdit;
}
public int getColumnCount() {
return columnNames.length;
}
public int getRowCount() {
return data.length;
}
public String getColumnName(int col) {
return columnNames[col];
}
public Object getValueAt(int row, int col) {
return data[row][col];
}
public Class getColumnClass(int c) {
return getValueAt(0, c).getClass();
}
/*
* Don't need to implement this method unless your table's
* editable.
*/
public boolean isCellEditable(int row, int col) {
//Note that the data/cell address is constant,
//no matter where the cell appears onscreen.
//
// if (col < 2) {
// return false;
// } else {
// return true;
// }
return true;
}
/*
* Don't need to implement this method unless your table's
* data can change.
*/
public void setValueAt(Object value, int row, int col) {
data[row][col] = value;
fireTableCellUpdated(row, col);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -