?? shoppinghistorytablemodel.java
字號:
package RegisterAndLogin;
import javax.swing.table.*;
public class ShoppingHistoryTableModel extends AbstractTableModel {
final String[] columnNames={"賣方","商品","數量","原價","議價","時間"};
final Object[][]data=new Object [20][6];
public ShoppingHistoryTableModel()
{
for(int i=0;i<20;i++)
for(int j=0;j<6;j++)
data[i][j]="";
}
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 void setValueAt(Object value,int row,int col)
{
data[row][col]=value;
fireTableCellUpdated(row, col);
}
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;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -