基于java的图书管理系统源代码
- 格式:doc
- 大小:236.50 KB
- 文档页数:66
声明:本系统是基于C/S的图书管理系统,主要使用的是Oracle数据库,下面附所有实现代码
package library;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class book_add extends JFrame implements ActionListener{ DataBaseManager db=new DataBaseManager();
ResultSet rs;
JPanel panel1,panel2;
JLabel book_id_label,book_name_label,author_label,
press_label,press_date_label,price_label,book_num_label,borrow ed_num_label,address;
JTextField
book_id_TextField,book_name_TextField,author_TextField,
press_TextField,press_date_TextField,price_TextField,book_num_ TextField,
borrowed_count;
JComboBox addresst;
Container c;
JButton clear,add,exit;
public book_add()
{
super("添加图书信息");
c=getContentPane();
c.setLayout(new BorderLayout());
book_id_label=new JLabel("编号",JLabel.CENTER);
book_name_label=new JLabel("名称",JLabel.CENTER);
author_label=new JLabel("作者",JLabel.CENTER);
press_label=new JLabel("出版社",JLabel.CENTER);
press_date_label=new JLabel("出版日期",JLabel.CENTER);
price_label=new JLabel("价格",JLabel.CENTER);
book_num_label=new JLabel("库存数",JLabel.CENTER);
borrowed_num_label=new JLabel("已借阅数",JLabel.CENTER);
address=new JLabel("藏书地址",JLabel.CENTER);
book_id_TextField=new JTextField(15);
book_name_TextField=new JTextField(15);
author_TextField=new JTextField(15);
press_TextField=new JTextField(15);
press_date_TextField=new JTextField(15);
price_TextField=new JTextField(15);
book_num_TextField=new JTextField(15);
borrowed_count=new JTextField(15);
borrowed_count.setText("0");
addresst=new JComboBox();
addresst.addItem("扬子津图书馆");
addresst.addItem("荷花池图书馆");
addresst.addItem("瘦西湖图书馆");
addresst.addItem("淮海路图书馆");
panel1=new JPanel();
panel1.setLayout(new GridLayout(9,2));
panel1.add(book_id_label);
panel1.add(book_id_TextField);
panel1.add(book_name_label);
panel1.add(book_name_TextField);
panel1.add(press_label);
panel1.add(press_TextField);
panel1.add(author_label);
panel1.add(author_TextField);
panel1.add(press_date_label);
panel1.add(press_date_TextField);
panel1.add(price_label);
panel1.add(price_TextField);
panel1.add(book_num_label);
panel1.add(book_num_TextField);
panel1.add(borrowed_num_label);
panel1.add(borrowed_count);
panel1.add(address);
panel1.add(addresst);
panel2=new JPanel();