最新JAVA课程设计(基于UI的图书管理系统).doc
《最新JAVA课程设计(基于UI的图书管理系统).doc》由会员分享,可在线阅读,更多相关《最新JAVA课程设计(基于UI的图书管理系统).doc(202页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateJAVA课程设计(基于UI的图书管理系统)JAVA课程设计(基于UI的图书管理系统)JAVA课程设计报告(图书管理系统)1. 系统目的与功能(1)本系统通链接ACCESS完成对用户信息和图书信息的管理,并制作可视化界面进行操作。(2)系统主要实现的功能有用户的登陆,图书的插入、修改、删除、查看、借阅、归还。2. 开发工具开发工具使用Eclipse作为主用开发环境,并使
2、用VE相关制作系统界面部分。3. 系统说明(以下名字都是类名)1. Access类来进行界面切换,数据库操作等。2. MainMenu、Regsdit类是系统登陆界面和用户注册界面。3. MainCl类是系统的主要界面。4. Insert、Look、Update、Delete、Sendbook、Backbook类分别用来进行图书插入、图书信息查看、图书信息修改、图书删除、借阅图书、归还图书。5. 程序代码Access类package access;import java.sql.*;import javax.swing.JLabel;import javax.swing.JPanel;impo
3、rt javax.swing.JTextField;import view.*;public class Access Connection conn = null;Statement stmt = null;ResultSet rs = null;PreparedStatement ps = null;String username; String temp;String password;String bookname;String bookid;String author;String publisher;String name;int count;JTextField test;JTe
4、xtField test1;JLabel jLabel;JPanel jpane;int result=0;public Access(String username, String password) this.username = username;this.password = password;try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);String strurl = jdbc:odbc:driver=Microsoft Access Driver (*.mdb);DBQ=D:workspacebookmis.mdb;conn = D
5、riverManager.getConnection(strurl);stmt = conn.createStatement(); catch (Exception e) public Access(String bookname,String bookid,String author,String publisher,JTextField test) this.bookname=bookname;this.bookid=bookid;this.author=author;this.publisher=publisher;this.test=test;try Class.forName(sun
6、.jdbc.odbc.JdbcOdbcDriver);String strurl = jdbc:odbc:driver=Microsoft Access Driver (*.mdb);DBQ=D:workspacebookmis.mdb;conn = DriverManager.getConnection(strurl);stmt = conn.createStatement(); catch (Exception e) public Access(String bookname,String bookid,String author,String publisher,JLabel jlabe
7、l) this.bookname=bookname;this.bookid=bookid;this.author=author;this.publisher=publisher;this.jLabel=jlabel;try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);String strurl = jdbc:odbc:driver=Microsoft Access Driver (*.mdb);DBQ=D:workspacebookmis.mdb;conn = DriverManager.getConnection(strurl);stmt = co
8、nn.createStatement(); catch (Exception e) public Access() try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);String strurl = jdbc:odbc:driver=Microsoft Access Driver (*.mdb);DBQ=D:workspacebookmis.mdb;conn = DriverManager.getConnection(strurl);stmt = conn.createStatement(); catch (Exception e) public A
9、ccess(String temp,JTextField test1) this.temp=temp;this.test1=test1;try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);String strurl = jdbc:odbc:driver=Microsoft Access Driver (*.mdb);DBQ=D:workspacebookmis.mdb;conn = DriverManager.getConnection(strurl);stmt = conn.createStatement(); catch (Exception e
10、) public Access(String aname,JPanel jpane,JLabel jLabel) name=aname;this.jpane=jpane;this.jLabel=jLabel;try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);String strurl = jdbc:odbc:driver=Microsoft Access Driver (*.mdb);DBQ=D:workspacebookmis.mdb;conn = DriverManager.getConnection(strurl);stmt = conn.c
11、reateStatement(); catch (Exception e) public Access(String aname,JLabel jLabel) name=aname;this.jLabel=jLabel;try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);String strurl = jdbc:odbc:driver=Microsoft Access Driver (*.mdb);DBQ=D:workspacebookmis.mdb;conn = DriverManager.getConnection(strurl);stmt =
12、conn.createStatement(); catch (Exception e) public void regsdit() try result=stmt.executeUpdate(insert into userinform(username,password) values(+username+,+password+); catch (SQLException e) / TODO 自动生成 catch 块new Fail().getJDialog();if (result = 1) MainMenu mainmenu = new MainMenu();mainmenu.getJF
13、rame(); else public void login() try rs=stmt.executeQuery(select * from userinform where username=+username+ and password=+password+);if(rs.next()MainCl maincl =new MainCl();maincl.getJFrame();else LoginFail loginfail=new LoginFail();loginfail.getJDialog(); catch (SQLException e) / TODO 自动生成 catch 块
14、e.printStackTrace();public void insert() try result=stmt.executeUpdate(insert into bookmis(bookname,num,auther,publisher) values(+bookname+,+bookid+,+author+,+publisher+); catch (SQLException e) / TODO 自动生成 catch 块e.printStackTrace();if(result=1)test.setText(插入成功);else test.setText(插入失败);public void
15、 look() Look alook =new Look();tryrs = stmt.executeQuery(select * from bookmis);while (rs.next() bookname=rs.getString(bookname);bookid=rs.getString(num);author=rs.getString(auther);publisher=rs.getString(publisher);count=rs.getInt(count);String acount=Integer.toString(count);String temp=书名: +bookna
16、me+ 编号: +bookid+ 作者: +author+ 出版社: +publisher+ 数量:+acount;alook.getList().add(temp);alook.getJFrame();alook.getList().add(nnnn);catch(Exception e)public void delete() tryresult=0;result=stmt.executeUpdate(delete from bookmis where bookname=+temp+);catch(Exception e)if(result=1)test1.setText(删除成功);el
17、se test1.setText(删除失败,你输入的书名有误);public void update() try rs = stmt.executeQuery(select * from bookmis where bookname=+name+);if(rs.next()stmt.executeUpdate(delete from bookmis where bookname=+name+);jpane.setVisible(true);elsejLabel.setText(请输入正确的书名); catch (SQLException e) public void aupdate() try
18、 result=stmt.executeUpdate(insert into bookmis(bookname,num,auther,publisher) values(+bookname+,+bookid+,+author+,+publisher+); catch (SQLException e) / TODO 自动生成 catch 块e.printStackTrace();if(result=1)jLabel.setText(修改成功);else jLabel.setText(修改失败);public void sendbook() try rs = stmt.executeQuery(s
19、elect * from bookmis where bookname=+name+);if(rs.next()int bcount=rs.getInt(count);if(bcount=0)jLabel.setText(书已经全部借完);return;stmt.executeUpdate(update bookmis set count=count-1 where bookname=+name+);jLabel.setText(借阅成功);elsejLabel.setText(没有这本书); catch (SQLException e) e.printStackTrace();public
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 最新 JAVA 课程设计 基于 UI 图书 管理 系统
限制150内