java编程,java图书管理系统设计

记住登录一个月发表随想还能输入:200字该用户最新代码编程随想&by by by by by by [java]代码库package Main_F
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import Achieve.*;
public class MainFrame extends JFrame {
CardLayout card = new CardLayout();
//定义卡片布局管理器
//public final Container p = getContentPane();
JMenuBar MenuBar = new JMenuBar();
//定义菜单条
//定义主菜单
bk_manage = new JMenu("图书管理"),
jy_manage = new JMenu("借阅管理"),
rd_manage = new JMenu("读者管理"),
help = new JMenu("帮助"),
readermanage = new JMenu("借阅人管理");
readermessage = new JMenuItem("借阅人信息"),
add_man = new JMenuItem("添加借阅人"),
alter_reader = new JMenuItem("修改借阅人信息"),
delete_man = new JMenuItem("删除借阅人");
//定义子菜单
look_up = new JMenuItem("详细查询"),
all_book = new JMenuItem("图书概览"),
alter_book = new JMenuItem("修改图书信息"),
borrow_book = new JMenuItem("借书"),
back_book = new JMenuItem("还书"),
pay = new JMenuItem("读者缴费"),
borrowReader_manage = new JMenuItem("借阅信息"),
look_introdece = new JMenuItem("系统介绍"),
about = new JMenuItem("关于");
//卡片面版转换监听
back_Frame backP = new back_Frame();
bookInfo_Frame bookInfoP = new bookInfo_Frame();
borrow_Frame borrowP = new borrow_Frame();
readerManage_Frame readerP = new readerManage_Frame();
Add_Borrow_Man addman = new Add_Borrow_Man();
BorrowMessage query = new BorrowMessage();
Del_Borrow_Man delete = new Del_Borrow_Man();
Pay payp = new Pay();
Alter_Frame alter= new Alter_Frame();
Alter_Reader_Message arm= new Alter_Reader_Message();
public void edit_MenuBar(){
MenuBar.add(bk_manage);
MenuBar.add(jy_manage);
MenuBar.add(rd_manage);
MenuBar.add(help);
bk_manage.add(look_up);
bk_manage.add(all_book);
bk_manage.add(alter_book);
jy_manage.add(borrow_book);
jy_manage.add(back_book);
rd_manage.add(readermanage);
readermanage.add(readermessage);
readermanage.add(add_man);
readermanage.add(alter_reader);
readermanage.add(delete_man);
rd_manage.add(borrowReader_manage);
rd_manage.add(pay);
help.add(look_introdece);
help.add(about);
public MainFrame(){
this.setTitle("计算机工程系图书管理系统");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setBounds(300, 200, 640, 430);
this.setResizable(false);
this.setJMenuBar(MenuBar);
this.edit_MenuBar();
final Container p = getContentPane();
p.setLayout(card);
ImageIcon bg = new ImageIcon("图片\\背景.jpg");
// 加载背景图片
JLabel label = new JLabel(bg);
// 把背景图片显示在一个标签里
label.setBounds(0,0,bg.getIconWidth(),bg.getIconHeight());
//把标签的大小位置设置为图片刚好填充整个面
this.getLayeredPane().add(label,new Integer(Integer.MIN_VALUE));
//添加图片到frame的第二层
JPanel jp=(JPanel)this.getContentPane();
//获取frame的最上层面板为了设置其背景颜色(JPanel有设置透明的方法)
jp.setOpaque(false);
p.add(new Welcome_Frame().welcome(),"card11");
look_up.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
p.add(bookInfoP.bookPanel(),"card1");
card.show(p, "card1");
borrow_book.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
p.add(borrowP.borrowPanel(),"card2");
card.show(p, "card2");
back_book.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
p.add(backP.backPanel(),"card3");
card.show(p,"card3");
borrowReader_manage.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
p.add(readerP.readerManagePanel(),"card4");
card.show(p, "card4");
add_man.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
p.add(addman.add_man(),"card5");
card.show(p, "card5");
readermessage.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
p.add(query.query_brman(),"card6");
card.show(p,"card6");
delete_man.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
p.add(delete.delete(),"card7");
card.show(p, "card7");
pay.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
p.add(payp.pay(),"card8");
card.show(p, "card8");
alter_book.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
p.add(alter.alter_book(),"card9");
card.show(p, "card9");
alter_reader.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
p.add(arm.alterreader(),"card10");
card.show(p, "card10");
look_introdece.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
new Introduce_Frame();
all_book.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
new All_Book_Frame();
about.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
new Copyright_Frame();
this.setVisible(true);
this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
int option = JOptionPane.showConfirmDialog(MainFrame.this,"你确定要退出系统?","温馨提示",JOptionPane.YES_NO_OPTION);
if(option==JOptionPane.YES_NO_OPTION) {
if (e.getWindow() == MainFrame.this) {
System.exit(0);
[代码运行效果截图][源代码打包下载](50积分)[124 次下载]分享到:更多回复评论共15 条评论
发表评论:评论须知:1、评论每次加2分,每天上限为30;2、请文明用语,共同创建干净的技术交流环境;3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。更多技术文章可以访问我的个人博客 www.rain1024.com
使用Java开发的图书管理系统
使用Java开发的图书管理系统
如题,用Java开发而成,具备基础功能,读者可以注册登录,登录时会判断账号类型再分别跳到各自对应的页面,读者可以查找,借阅,还书,查看历史借阅记录,修改个人资料,密码等,管理员可以修改添加图书,修改添加读者,修改添加分类,管理借阅信息等等。
具体功能如下图
读者登录页面
读者资料修改页面
读者图书查询页面
读者当前借阅信息页面
读者历史借阅信息显示页面
管理员登录页面
管理员管理图书信息页面
管理员添加图书页面
管理员管理用户界面
管理员添加读者信息的页面
管理员管理图书分类的页面
管理员管理图书借阅信息的页面
管理员管理已还书信息的页面
扫码向博主提问
非学,无以致疑;非问,无以广识
java图书管理系统
Java入门教程之图书管理系统(由简入繁)(二)
java图书管理系统(窗体)
JAVA简单的图书管理系统
图书管理系统Java
从零开始学Java自己利用接口和集合框架做的简单图书管理系统
没有更多推荐了,http://weixublog.xyz ,欢迎访问~
Java版本:图书管理系统
实验目的:掌握数据库编程技术。能正确连接数据库,能对数据库中信息进行查询、插入、删除、修改。
实验内容:在数据库中创建一张书目信息表,包括书名、作者、出版社、出版日期、书号、价格字段。设计一个GUI界面进行书目管理。在该界面上有四个选项卡,分别是查询、插入、删除、修改。点击查询选项卡,出现的界面上有书名、作者、出版社、书号四个文本框,一个按钮和一个只读文本区。文本框内容可以为空,输入相应的查询信息后(例如根据书名查询可以仅输入书名),点击界面上的“查询”按钮,可以在界面下方的文本区中显示出符合条件的书目详细信息。点击插入选项卡,出现的界面上有书名、作者、出版社、出版日期、书号、价格文本框,一个按钮。在文本框中输入信息后,点击“插入”按钮,该书目信息插入数据库表中。点击删除选项卡,出现的界面上有书名文本框和一个按钮,输入书名后点击“删除”按钮,该书目信息从数据库表中删除。点击修改选项卡,出现的界面上有书名、作者、出版社、出版日期、书号、价格文本框,一个按钮。输入的书名必须是已存在的,否则会弹出消息框显示出错信息。输入信息后,点击“修改”按钮,数据库表中的相应书目信息被修改为新值。
实验源码:
BookInfo.java
&strong&/&/strong&*
* 项目名称:图书管理系统
* 创建时间:
package libraryS
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
@SuppressWarnings("serial")
public class BookInfo extends JFrame implements ActionListener{
//主角面上的控件
private JLabel inputL
private JTextField inputT
private JButton searchB
private JTable bookT
private JScrollPane bookS
private JButton addB
private JButton modifyB
private JButton deleteB
private JButton refreshB
private BookTableModel bookTableM
public static void main(String[] args) throws SQLException {
// TODO Auto-generated method stub
BookInfo bookInfo=new BookInfo();
bookInfo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
bookInfo.setBounds(350, 150, 600, 400);
bookInfo.setVisible(true);
bookInfo.importSQL();//导出数据
bookInfo.setMinWindowLayout();//设置数据
public BookInfo() throws SQLException{
//创建主界面上的控件
inputLabel=new JLabel("请输入书名:");
inputText=new JTextField(10);
searchBut=new JButton("查询");
bookTableModel=new BookTableModel();
bookTable=new JTable(bookTableModel);
bookScroll=new JScrollPane(bookTable);
addBut=new JButton("添加");
modifyBut=new JButton("修改");
deleteBut=new JButton("删除");
refreshBut=new JButton("刷新");
searchBut.addActionListener(this);
addBut.addActionListener(this);
refreshBut.addActionListener(this);
modifyBut.addActionListener(this);
deleteBut.addActionListener(this);
void setMinWindowLayout(){
//主界面布局
Container con1=new Container();
con1.setLayout(new FlowLayout());
con1.add(inputLabel);
con1.add(inputText);
con1.add(searchBut);
con1.add(refreshBut);
Container con2=new Container();
con2.setLayout(new FlowLayout());
con2.add(addBut);
con2.add(modifyBut);
con2.add(deleteBut);
this.setLayout(new BorderLayout());
this.add(con1,BorderLayout.NORTH);
this.add(bookScroll,BorderLayout.CENTER);
this.add(con2,BorderLayout.SOUTH);
this.validate();
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==searchBut){
if(!this.inputText.getText().equals("")){
String bookName=this.inputText.getText();
String sql="SELECT * FROM book_info WHERE book_name ='"+bookName+"'";
bookTableModel=new BookTableModel(sql);
bookTable.setModel(bookTableModel);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
JOptionPane.showMessageDialog(this,"输入不能为空", "提示",JOptionPane.PLAIN_MESSAGE);
else if(e.getSource()==addBut){
@SuppressWarnings("unused")
AddBookDialog addWin=new AddBookDialog(this,"添加图书",true);
this.refreshTable();
else if(e.getSource()==refreshBut){
this.refreshTable();
else if(e.getSource()==deleteBut){
int rowNum=bookTable.getSelectedRow();
if(rowNum&0||rowNum&bookTable.getRowCount()){
JOptionPane.showMessageDialog(this,"未选中", "提示",JOptionPane.PLAIN_MESSAGE);
//System.out.print(bookName);
int n = JOptionPane.showConfirmDialog(null, "确认删除吗?", "确认删除框", JOptionPane.YES_NO_OPTION);
if (n == JOptionPane.YES_OPTION) {
String bookNum=(String) bookTable.getValueAt(rowNum, 0);
String sql="DELETE FROM book_info WHERE book_num= '"+bookNum+"'";
bookTableModel.deleteBook(sql);
this.refreshTable();
JOptionPane.showMessageDialog(this,"删除成功", "提示",JOptionPane.PLAIN_MESSAGE);
} else if (n == JOptionPane.NO_OPTION) {
else if(e.getSource()==modifyBut){
bookTable.setModel(bookTableModel);
int rowNum=bookTable.getSelectedRow();
if(rowNum&0||rowNum&bookTable.getRowCount()){
JOptionPane.showMessageDialog(this,"未选中", "提示",JOptionPane.PLAIN_MESSAGE);
@SuppressWarnings("unused")
ModifyBook modifyWin=new ModifyBook(this,"修改信息",true,bookTableModel,rowNum);
this.refreshTable();
public void refreshTable(){
BookTableModel searchB
searchBook = new BookTableModel("SELECT * FROM book_info");
bookTable.setModel(searchBook);
bookTableModel=searchB
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
BookTableModel.java
package libraryS
import java.sql.*;
import java.util.*;
* 图书表模型
import javax.swing.table.*;
@SuppressWarnings("serial")
public class BookTableModel extends AbstractTableModel{
//表的元素
private Vector&Vector&String&& rowD
private Vector&String& colN
private PreparedS
private ResultS
public BookTableModel(String sql) throws SQLException{
this.initData(sql);
public BookTableModel() throws SQLException{
this.initData("SELECT * FROM book_info");
public void initData(String sql) throws SQLException{
setRowData(new Vector&Vector&String&&());
setColName(new Vector&String&());
getColName().add("书号");
getColName().add("书名");
getColName().add("作者");
getColName().add("出版社");
getColName().add("出版时间");
getColName().add("价格");
* 数据库的导入
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
String url= "jdbc:mysql://localhost:3306/device";
String user="root";
String password="123456";
Connection con=DriverManager.getConnection(url,user,password);
stmt = con.prepareStatement(sql);
result=stmt.executeQuery();
importSQL();
void importSQL() throws SQLException{
// TODO Auto-generated method stub
@SuppressWarnings("unused")
boolean signNull=
while(result.next()){
Vector&String& item=new Vector&String&();
for(int i=1;i&7;i++){
item.add(result.getString(i));
getRowData().add(item);
result.close();
public int getColumnCount() {//得到列数
// TODO Auto-generated method stub
return this.colName.size();
public int getRowCount() {//得到行数
// TODO Auto-generated method stub
return this.rowData.size();
public Object getValueAt(int row, int col) {//得到某行某列的数据
// TODO Auto-generated method stub
return (this.rowData.get(row)).get(col);
public String getColumnName(int column) {
// TODO Auto-generated method stub
return this.colName.get(column);
public Vector&Vector&String&& getRowData() {
return rowD
public void setRowData(Vector&Vector&String&& rowData) {
this.rowData = rowD
public Vector&String& getColName() {
return colN
public void setColName(Vector&String& colName) {
this.colName = colN
public void addBook(String sql){
stmt.executeUpdate(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
initData("SELECT * FROM book_info");
public void deleteBook(String sql){
stmt.executeUpdate(sql);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
AddBookDialog.java
package libraryS
import java.awt.*;
import java.awt.event.*;
import java.sql.SQLE
import javax.swing.*;
@SuppressWarnings("serial")
public class AddBookDialog extends JDialog implements ActionListener{
private JLabel bookNumL
private JLabel bookNameL
private JLabel bookWriterL
private JLabel bookPublishL
private JLabel bookPriceL
private JLabel bookTimeL
private JTextField bookNumT
private JTextField bookNameT
private JTextField bookWriterT
private JTextField bookPublishT
private JTextField bookPriceT
private JTextField bookTimeT
private JButton submitB
private JButton cancelB
public AddBookDialog(Frame owner,String title,boolean model){
//父窗口,窗口名,是否是模式窗口
super(owner,title,model);
bookNumLabel=new JLabel("书
bookNameLabel=new JLabel("书
bookWriterLabel=new JLabel("作
bookPublishLabel=new JLabel("出版社:");
bookPriceLabel=new JLabel("价
bookTimeLabel=new JLabel("出版时间:");
bookNumText=new JTextField(10);
bookNameText=new JTextField(10);
bookWriterText=new JTextField(10);
bookPublishText=new JTextField(10);
bookPriceText=new JTextField(10);
bookTimeText=new JTextField(9);
submitBut=new JButton("确认");
cancelBut=new JButton("取消");
submitBut.addActionListener(this);
cancelBut.addActionListener(this);
this.setBounds(350,150,400,260);
this.setResizable(false);
this.setLayout(new BorderLayout());
initLayout();
public void initLayout(){
Container[] con1=new Container[6];
for(int i=0;i&6;i++) con1[i]=new Container();
con1[0].setLayout(new FlowLayout());
con1[0].add(bookNumLabel);
con1[0].add(bookNumText);
con1[1].setLayout(new FlowLayout());
con1[1].add(bookNameLabel);
con1[1].add(bookNameText);
con1[2].setLayout(new FlowLayout());
con1[2].add(bookWriterLabel);
con1[2].add(bookWriterText);
con1[3].setLayout(new FlowLayout());
con1[3].add(bookPublishLabel);
con1[3].add(bookPublishText);
con1[4].setLayout(new FlowLayout());
con1[4].add(bookPriceLabel);
con1[4].add(bookPriceText);
con1[5].setLayout(new FlowLayout());
con1[5].add(bookTimeLabel);
con1[5].add(bookTimeText);
Container con2=new Container();
con2.setLayout(new BorderLayout());
con2.add(con1[0],BorderLayout.NORTH);
con2.add(con1[1],BorderLayout.CENTER);
con2.add(con1[2],BorderLayout.SOUTH);
Container con3=new Container();
con3.setLayout(new BorderLayout());
con3.add(con1[3],BorderLayout.NORTH);
con3.add(con1[4],BorderLayout.CENTER);
con3.add(con1[5],BorderLayout.SOUTH);
Container con4=new Container();
con4.setLayout(new FlowLayout());
con4.add(submitBut);
con4.add(cancelBut);
Container con5=new Container();
con5.setLayout(new BorderLayout());
con5.add(con2,BorderLayout.NORTH);
con5.add(con3,BorderLayout.CENTER);
con5.add(con4,BorderLayout.SOUTH);
this.add(con5,BorderLayout.CENTER);
this.validate();
this.setVisible(true);
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==submitBut){
if(bookNumText.getText().equals("")||bookNameText.getText().equals("")||
bookWriterText.getText().equals("")||bookPublishText.getText().equals("")||
bookPriceText.getText().equals("")||bookTimeText.getText().equals("")){
//System.out.println("输入失败");
JOptionPane.showMessageDialog(this,"输入不能有空", "提示",JOptionPane.PLAIN_MESSAGE);
//System.out.println("输入成功");
String sql="insert into "
+ "book_info(book_num,book_name,book_writer,publish_house,book_price,publish_time)"
+ "values('"+bookNumText.getText()+"','"+bookNameText.getText()+"','"+bookWriterText.getText()+"','"+bookPublishText.getText()+"','"+bookPriceText.getText()+"','"+bookTimeText.getText()+"')";
BookTableModel book=new BookTableModel();
book.addBook(sql);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
JOptionPane.showMessageDialog(this,"添加成功", "提示",JOptionPane.PLAIN_MESSAGE);
this.setVisible(false);
if(e.getSource()==cancelBut){
this.setVisible(false);
ModifyBook.java
package libraryS
import java.awt.*;
import java.awt.event.*;
import java.sql.SQLE
import javax.swing.*;
@SuppressWarnings("serial")
public class ModifyBook extends JDialog implements ActionListener{
private JLabel bookNumL
private JLabel bookNameL
private JLabel bookWriterL
private JLabel bookPublishL
private JLabel bookPriceL
private JLabel bookTimeL
private JTextField bookNumT
private JTextField bookNameT
private JTextField bookWriterT
private JTextField bookPublishT
private JTextField bookPriceT
private JTextField bookTimeT
private JButton submitB
private JButton cancelB
private BookTableModel bookM
private int rowN
public ModifyBook(Frame owner,String title,boolean type,BookTableModel model,int row){
super(owner,title,type);
bookModel=
bookNumLabel=new JLabel("书
bookNameLabel=new JLabel("书
bookWriterLabel=new JLabel("作
bookPublishLabel=new JLabel("出版社:");
bookPriceLabel=new JLabel("价
bookTimeLabel=new JLabel("出版时间:");
bookNumText=new JTextField(10);
bookNameText=new JTextField(10);
bookWriterText=new JTextField(10);
bookPublishText=new JTextField(10);
bookPriceText=new JTextField(10);
bookTimeText=new JTextField(9);
submitBut=new JButton("确认修改");
cancelBut=new JButton("取消");
submitBut.addActionListener(this);
cancelBut.addActionListener(this);
this.setBounds(350,150,400,260);
this.setResizable(false);
this.setLayout(new BorderLayout());
this.setValue();
this.initLayout();
public void initLayout(){
Container[] con1=new Container[6];
for(int i=0;i&6;i++) con1[i]=new Container();
con1[0].setLayout(new FlowLayout());
con1[0].add(bookNumLabel);
con1[0].add(bookNumText);
con1[1].setLayout(new FlowLayout());
con1[1].add(bookNameLabel);
con1[1].add(bookNameText);
con1[2].setLayout(new FlowLayout());
con1[2].add(bookWriterLabel);
con1[2].add(bookWriterText);
con1[3].setLayout(new FlowLayout());
con1[3].add(bookPublishLabel);
con1[3].add(bookPublishText);
con1[4].setLayout(new FlowLayout());
con1[4].add(bookPriceLabel);
con1[4].add(bookPriceText);
con1[5].setLayout(new FlowLayout());
con1[5].add(bookTimeLabel);
con1[5].add(bookTimeText);
Container con2=new Container();
con2.setLayout(new BorderLayout());
con2.add(con1[0],BorderLayout.NORTH);
con2.add(con1[1],BorderLayout.CENTER);
con2.add(con1[2],BorderLayout.SOUTH);
Container con3=new Container();
con3.setLayout(new BorderLayout());
con3.add(con1[3],BorderLayout.NORTH);
con3.add(con1[4],BorderLayout.CENTER);
con3.add(con1[5],BorderLayout.SOUTH);
Container con4=new Container();
con4.setLayout(new FlowLayout());
con4.add(submitBut);
con4.add(cancelBut);
Container con5=new Container();
con5.setLayout(new BorderLayout());
con5.add(con2,BorderLayout.NORTH);
con5.add(con3,BorderLayout.CENTER);
con5.add(con4,BorderLayout.SOUTH);
this.add(con5,BorderLayout.CENTER);
this.validate();
this.setVisible(true);
public void setValue(){
this.bookNumText.setText((String) bookModel.getValueAt(rowNum, 0));
this.bookNumText.setEditable(false);
this.bookNameText.setText((String) bookModel.getValueAt(rowNum, 1));
this.bookWriterText.setText((String) bookModel.getValueAt(rowNum, 2));
this.bookPublishText.setText((String) bookModel.getValueAt(rowNum, 3));
this.bookTimeText.setText((String) bookModel.getValueAt(rowNum, 4));
this.bookPriceText.setText((String) bookModel.getValueAt(rowNum, 5));
this.validate();
public void actionPerformed(ActionEvent e) {
// System.out.println(bookPriceText.getText());
// TODO Auto-generated method stub
if(e.getSource()==submitBut){
if(bookNumText.getText().equals("")||bookNameText.getText().equals("")||
bookWriterText.getText().equals("")||bookPublishText.getText().equals("")||
bookPriceText.getText().equals("")||bookTimeText.getText().equals("")){
//System.out.println("输入失败");
JOptionPane.showMessageDialog(this,"修改不能有空", "提示",JOptionPane.PLAIN_MESSAGE);
int n = JOptionPane.showConfirmDialog(null, "确认修改吗?", "确认修改框", JOptionPane.YES_NO_OPTION);
if (n == JOptionPane.YES_OPTION) {
String sql="UPDATE book_info SET book_name ='"+bookNameText.getText()+"', book_writer= '"+bookWriterText.getText()+"',publish_house='"+bookPublishText.getText()+"',book_price='"+bookPriceText.getText()+"',publish_time='"+bookTimeText.getText()+"' WHERE book_num = '"+bookNumText.getText()+"' ";
BookTableModel book=new BookTableModel();
book.addBook(sql);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
JOptionPane.showMessageDialog(this,"修改成功", "提示",JOptionPane.PLAIN_MESSAGE);
this.setVisible(false);
} else if (n == JOptionPane.NO_OPTION) {
if(e.getSource()==cancelBut){
this.setVisible(false);
程序运行结果:主界面:
查询界面:
添加图书界面:
修改界面:
删除操作:
数据库界面:
没有更多推荐了,}

我要回帖

更多关于 java图书管理系统课程设计 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信