java jdbtable
发布网友
发布时间:2023-11-11 07:03
我来回答
共1个回答
热心网友
时间:2024-12-02 04:21
int row = this.jTable1.getSelectedRow();
if(row==-1){
JOptionPane.showMessageDialog(this,"请选择要修改或删除的一行");//判断是否选中某行,如果选中则取该行的值。
}else{
String roomid = this.jTable1.getValueAt(row, 0).toString();
String roomno = this.jTable1.getValueAt(row, 1).toString();
String rtname = this.jTable1.getValueAt(row, 2).toString();
String state = this.jTable1.getValueAt(row, 3).toString();
String number = this.jTable1.getValueAt(row, 4).toString();
String desp = this.jTable1.getValueAt(row,5).toString();
//想取哪行就赋值哪行的值即可,这是个例子!