public void addRecord() {
Interception in = getInput();
if (in != null) {

in.setID(DataBaseClass.CreateID(OMTTables.interception, "ID", 1)[0]);
NewDBModel.getInterceptionDB().setInterception(in);
Vector tmp=new Vector();
tmp.addElement(new Integer(in.getID()));//ID的取值有问题,该怎么写?
tmp.addElement(new Integer(in.getReason()));
tmp.addElement(in.getUri());
tmp.addElement(in.getResv());
model.addRow(tmp);
changeButtonStatus();
}
} public void modifyRecord() {
Interception in = getInput();
if (in != null) {
in.setID(((Integer)table.getValueAt(table.getSelectedRow(), 0)).intValue());
NewDBModel.getInterceptionDB().setInterception(in);
Vector tmp=new Vector();
tmp.addElement(new Integer(in.getID()));
tmp.addElement(new Integer(in.getReason()));
tmp.addElement(in.getUri());
tmp.addElement(in.getResv());
model.setValueAt("", 0, 0); //这不知道怎么写?
changeButtonStatus();
}
} public void deleteRecord() {
Interception in = new Interception();
in.setID(((Integer) table.getValueAt(table.getSelectedRow(), 0)).intValue());
if (JOptionPane.showConfirmDialog(this,
"Are you sure to delete the record which selected?", "Notice",
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
in.setID(((Integer) table.getValueAt(table.getSelectedRow(), 0)).intValue());
NewDBModel.getInterceptionDB().setInterception(in);
Vector tmp=new Vector();
tmp.addElement(new Integer(in.getID()));
tmp.addElement(new Integer(in.getReason()));
tmp.addElement(in.getUri());
tmp.addElement(in.getResv());
int row = table.getSelectedRow();
model.removeRow(row);
changeButtonStatus();
} else
return;
}
这是一个窗口点add modify delete对窗口数据显示的操作.
现在的问题是,每次增加时,ID没有变换,都是相同的,我想每次增加时ID都自动加1
我那样肯定写肯定有问题,因为ID值根本就取不到,还有点modify按钮时不起作用,请问我注释的那行该怎么写?望高手指点,非常感谢!