java课程设计----图书馆管理系统
//查询数据库
public void search(){ }
//删除选定的记录 public void delete(){ }
//内部类,用于显示/编辑图书信息的一个模式对话框
class BookEditor extends JDialog implements ActionListener {
final int OK=1;
final int CANCEL=-1; final int CLOSE=0;
private int actionCode=CANCEL; int selected=table.getSelectedRow();
if(selected>=0&&selected<model.getRowCount()){ } else
JOptionPane.showMessageDialog(f,"请选定要删除的一行!"
,"提示",RMATION_MESSAGE);
int result=JOptionPane.showConfirmDialog (f,"您确定要删除该条图书信息 ,"确认",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE); if (result!=JOptionPane.YES_OPTION) return ;
String deleteSql="delete from bookInfo where bookID=?"; Object []keys={model.getValueAt(selected,0).toString()}; if(SqlUtil.deleteFromDB(con,deleteSql,keys))
model.removeRow(selected);
SearchDialog sd=new SearchDialog(f,"查询",true); sd.show();
if(sd.getActionCode()==sd.OK){ }
String readSql=sd.getSQL();
SqlUtil.readDBToTable(con,readSql,model,dataType);
吗?"
private JLabel labID=new JLabel(" 图书编号 "); private JTextField txtID=new JTextField();
private JLabel labBookName=new JLabel(" 图书名称 "); private JTextField txtBookName=new JTextField(); private JTextField txtBookPrice=new JTextField(); private JTextField txtBookPress=new JTextField(); private JButton btnPre=new JButton("上一个"); private JButton btnNext=new JButton("下一个");
private JLabel labBookPrice=new JLabel(" 单 价 "); private JLabel labBookPress=new JLabel(" 出 版 社 ");