图书馆管理系统文档格式.docx
《图书馆管理系统文档格式.docx》由会员分享,可在线阅读,更多相关《图书馆管理系统文档格式.docx(33页珍藏版)》请在冰豆网上搜索。
,Font.BOLD,14);
publicBookAddFrame()
{
this.setTitle("
添加书籍"
);
this.setSize(400,600);
this.setLayout(null);
this.setResizable(false);
this.setVisible(true);
this.addCompnents();
this.add(getbookName());
this.add(getbookNo());
this.add(getbookPress());
this.add(getbookPrice());
this.add(getbookWriter());
this.add(getbookPosition());
this.add(getbookRemain());
}
privatevoidaddCompnents()
bookNameLabel=newJLabel("
书名:
"
bookNameLabel.setFont(font);
bookNameLabel.setBounds(100,10,60,20);
this.add(bookNameLabel);
bookNoLabel=newJLabel("
书号:
bookNoLabel.setFont(font);
bookNoLabel.setBounds(100,50,60,20);
this.add(bookNoLabel);
bookPressLabel=newJLabel("
出版社:
bookPressLabel.setFont(font);
bookPressLabel.setBounds(100,90,60,20);
this.add(bookPressLabel);
bookPriceLabel=newJLabel("
价格:
bookPriceLabel.setFont(font);
bookPriceLabel.setBounds(100,130,60,20);
this.add(bookPriceLabel);
bookWriterLabel=newJLabel("
作者:
bookWriterLabel.setFont(font);
bookWriterLabel.setBounds(100,170,60,20);
this.add(bookWriterLabel);
bookPositionLabel=newJLabel("
位置:
bookPositionLabel.setFont(font);
bookPositionLabel.setBounds(100,210,60,20);
this.add(bookPositionLabel);
bookRemainLabel=newJLabel("
进货量:
bookRemainLabel.setFont(font);
bookRemainLabel.setBounds(100,250,60,20);
this.add(bookRemainLabel);
YesBtn=newJButton("
确定"
YesBtn.setFont(font);
YesBtn.setBounds(130,300,80,30);
this.add(YesBtn);
NoBtn=newJButton("
取消"
NoBtn.setFont(font);
NoBtn.setBounds(220,300,80,30);
this.add(NoBtn);
YesBtn.addActionListener(newActionListener()//添加确认按钮响应
{
@Override
publicvoidactionPerformed(ActionEvente)
{
//TODO自动生成的方法存根
Stringsql="
insertintoBook(bookNo,bookName,bookPress,bookPrice,bookWriter,bookPosition,bookRemain)values("
+bookNo.getText()+"
'
+bookName.getText()+"
'
+bookPress.getText()+"
"
+bookPrice.getText()+"
+bookWriter.getText()+"
+bookPosition.getText()+"
+bookRemain.getText()+"
;
try{
myCon.getStatement().executeUpdate(sql);
myCon.breakDB();
}catch(SQLExceptione1){
e1.printStackTrace();
}
MFrameframe=newMFrame();
dispose();
}
});
NoBtn.addActionListener(newActionListener()
@Override
publicvoidactionPerformed(ActionEvente){
//TODO自动生成的方法存根
MFrameframe=newMFrame();
dispose();
});
publicstaticJTextFieldgetbookName()
if(bookName==null){
bookName=newJTextField();
bookName.setBounds(155,10,150,20);
bookName.setFont(font);
bookName.setForeground(Color.blue);
}
returnbookName;
publicstaticJTextFieldgetbookNo()
if(bookNo==null)
bookNo=newJTextField();
bookNo.setFont(font);
bookNo.setBounds(155,50,150,20);
bookNo.setForeground(Color.blue);
returnbookNo;
publicstaticJTextFieldgetbookPress()
if(bookPress==null)
bookPress=newJTextField();
bookPress.setFont(font);
bookPress.setBounds(155,90,150,20);
bookPress.setForeground(Color.blue);
returnbookPress;
publicstaticJTextFieldgetbookPrice()
if(bookPrice==null)
bookPrice=newJTextField();
bookPrice.setFont(font);
bookPrice.setBounds(155,130,150,20);
bookPrice.setForeground(Color.blue);
returnbookPrice;
publicstaticJTextFieldgetbookWriter()
if(bookWriter==null)
bookWriter=newJTextField();
bookWriter.setFont(font);
bookWriter.setBounds(155,170,150,20);
bookWriter.setForeground(Color.blue);
returnbookWriter;
publicstaticJTextFieldgetbookPosition()
if(bookPosition==null)
bookPosition=newJTextField();
bookPosition.setFont(font);
bookPosition.setBounds(155,210,150,20);
bookPosition.setForeground(Color.blue);
returnbookPosition;
publicstaticJTextFieldgetbookRemain()
if(bookRemain==null)
bookRemain=newJTextField();
bookRemain.setFont(font);
bookRemain.setBounds(155,250,150,20);
bookRemain.setForeground(Color.blue);
returnbookRemain;
//publicvoidsetFrame(LoginFrameframe){
//this.frame1=frame;
//}
}
importjava.sql.ResultSet;
classBookSERFrameextendsJFrame//修改书籍
privatestaticJTextFieldbookName,bookNo,bookPress,bookPrice,bookWriter,bookPosition,bookRemain;
privateJLabelbookNameLabel,bookNoLabel,bookPressLabel,bookPriceLabel,bookWriterLabel,bookPositionLabel,bookRemainLabel;
publicBookSERFrame()
修改书籍"
bookNoLabel.setBounds(100,10,60,20);
bookNameLabel.setBounds(100,120,60,20);
bookPressLabel.setBounds(95,160,60,20);
bookPriceLabel.setBounds(100,200,60,20);
bookWriterLabel.setBounds(100,240,60,20);
bookPositionLabel.setBounds(100,280,60,20);
库存:
bookRemainLabel.setBounds(100,320,60,20);
YesBtn.setBounds(130,50,80,30);
NoBtn.setBounds(220,50,80,30);
//bookName,bookNo,bookPress,bookPrice,bookWriter,bookPosition,bookRemain
Stringsql="
select*fromBookwherebookNo="
+bookNo.getText()+"
try{
myCon.getStatement().executeUpdate(sql);
myCon.breakDB();
}catch(SQLExceptione1){
e1.printStackTrace();
}
}
bookNo.setBounds(150,10,150,20);
bookName.setBounds(150,120,150,20);
bookPress.setBounds(150,160,150,20);
bookPrice.setBounds(150,200,150,20);
bookWriter.setBounds(150,240,150,20);
bookPosition.setBounds(150,280,150,20);
bookRemain.setBounds(150,320,150,20);
importjava.sql.PreparedStat