JAVA课程设计基于UI的图书管理系统.docx

上传人:b****6 文档编号:6387691 上传时间:2023-01-05 格式:DOCX 页数:49 大小:27.20KB
下载 相关 举报
JAVA课程设计基于UI的图书管理系统.docx_第1页
第1页 / 共49页
JAVA课程设计基于UI的图书管理系统.docx_第2页
第2页 / 共49页
JAVA课程设计基于UI的图书管理系统.docx_第3页
第3页 / 共49页
JAVA课程设计基于UI的图书管理系统.docx_第4页
第4页 / 共49页
JAVA课程设计基于UI的图书管理系统.docx_第5页
第5页 / 共49页
点击查看更多>>
下载资源
资源描述

JAVA课程设计基于UI的图书管理系统.docx

《JAVA课程设计基于UI的图书管理系统.docx》由会员分享,可在线阅读,更多相关《JAVA课程设计基于UI的图书管理系统.docx(49页珍藏版)》请在冰豆网上搜索。

JAVA课程设计基于UI的图书管理系统.docx

JAVA课程设计基于UI的图书管理系统

JAVA

课程设计报告

(图书管理系统)

1.系统目的与功能

(1)本系统通链接ACCESS完成对用户信息和图书信息的管理,并制作可视化界面进行操作。

(2)系统主要实现的功能有用户的登陆,图书的插入、修改、删除、查看、借阅、归还。

2.开发工具

开发工具使用Eclipse作为主用开发环境,并使用VE相关制作系统界面部分。

3.系统说明(以下名字都是类名)

1.Access类来进行界面切换,数据库操作等。

2.MainMenu、Regsdit类是系统登陆界面和用户注册界面。

3.MainCl类是系统的主要界面。

4.Insert、Look、Update、Delete、Sendbook、Backbook类分别用来进行图书插入、图书信息查看、图书信息修改、图书删除、借阅图书、归还图书。

5.程序代码

Access类

packageaccess;

importjava.sql.*;

import

import

import

importview.*;

publicclassAccess{

Connectionconn=null;

Statementstmt=null;

ResultSetrs=null;

PreparedStatementps=null;

Stringusername;

Stringtemp;

Stringpassword;

Stringbookname;

Stringbookid;

Stringauthor;

Stringpublisher;

Stringname;

intcount;

JTextFieldtest;

JTextFieldtest1;

JLabeljLabel;

JPaneljpane;

intresult=0;

publicAccess(Stringusername,Stringpassword){

this.username=username;

this.password=password;

try{

Class.forName();

Stringstrurl="jdbc:

odbc:

driver={MicrosoftAccessDriver(*.mdb)};DBQ=D:

\\workspace\\bookmis.mdb";

conn=DriverManager.getConnection(strurl);

stmt=conn.createStatement();

}catch(Exceptione){

}

}

publicAccess(Stringbookname,Stringbookid,Stringauthor,Stringpublisher,JTextFieldtest){

this.bookname=bookname;

this.bookid=bookid;

this.author=author;

this.publisher=publisher;

this.test=test;

try{

Class.forName();

Stringstrurl="jdbc:

odbc:

driver={MicrosoftAccessDriver(*.mdb)};DBQ=D:

\\workspace\\bookmis.mdb";

conn=DriverManager.getConnection(strurl);

stmt=conn.createStatement();

}catch(Exceptione){

}

}

publicAccess(Stringbookname,Stringbookid,Stringauthor,Stringpublisher,JLabeljlabel){

this.bookname=bookname;

this.bookid=bookid;

this.author=author;

this.publisher=publisher;

this.jLabel=jlabel;

try{

Class.forName();

Stringstrurl="jdbc:

odbc:

driver={MicrosoftAccessDriver(*.mdb)};DBQ=D:

\\workspace\\bookmis.mdb";

conn=DriverManager.getConnection(strurl);

stmt=conn.createStatement();

}catch(Exceptione){

}

}

publicAccess(){

try{

Class.forName();

Stringstrurl="jdbc:

odbc:

driver={MicrosoftAccessDriver(*.mdb)};DBQ=D:

\\workspace\\bookmis.mdb";

conn=DriverManager.getConnection(strurl);

stmt=conn.createStatement();

}catch(Exceptione){

}

}

publicAccess(Stringtemp,JTextFieldtest1){

this.temp=temp;

this.test1=test1;

try{

Class.forName();

Stringstrurl="jdbc:

odbc:

driver={MicrosoftAccessDriver(*.mdb)};DBQ=D:

\\workspace\\bookmis.mdb";

conn=DriverManager.getConnection(strurl);

stmt=conn.createStatement();

}catch(Exceptione){

}

}

publicAccess(Stringaname,JPaneljpane,JLabeljLabel){

name=aname;

this.jpane=jpane;

this.jLabel=jLabel;

try{

Class.forName();

Stringstrurl="jdbc:

odbc:

driver={MicrosoftAccessDriver(*.mdb)};DBQ=D:

\\workspace\\bookmis.mdb";

conn=DriverManager.getConnection(strurl);

stmt=conn.createStatement();

}catch(Exceptione){

}

}

publicAccess(Stringaname,JLabeljLabel){

name=aname;

this.jLabel=jLabel;

try{

Class.forName();

Stringstrurl="jdbc:

odbc:

driver={MicrosoftAccessDriver(*.mdb)};DBQ=D:

\\workspace\\bookmis.mdb";

conn=DriverManager.getConnection(strurl);

stmt=conn.createStatement();

}catch(Exceptione){

}

}

publicvoidregsdit(){

try{

result=stmt.executeUpdate("insertintouserinform(username,password)values('"+username+"','"+password+"')");

}catch(SQLExceptione){

//TODO自动生成catch块

newFail().getJDialog();

}

if(result==1){

MainMenumainmenu=newMainMenu();

mainmenu.getJFrame();

}else{

}

}

publicvoidlogin(){

try{

rs=stmt.executeQuery("select*fromuserinformwhereusername='"+username+"'andpassword='"+password+"'");

if(rs.next())

{

MainClmaincl=newMainCl();

maincl.getJFrame();

}

else{

LoginFailloginfail=newLoginFail();

loginfail.getJDialog();

}

}catch(SQLExceptione){

//TODO自动生成catch块

e.printStackTrace();

}

}

publicvoidinsert(){

try{

result=stmt.executeUpdate("insertintobookmis(bookname,num,auther,publisher)values('"+bookname+"','"+bookid+"','"+author+"','"+publisher+"')");

}catch(SQLExceptione){

//TODO自动生成catch块

e.printStackTrace();

}

if(result==1){

test.setText("插入成功");

}

elsetest.setText("插入失败");

}

publicvoidlook(){

Lookalook=newLook();

try{

rs=stmt.executeQuery("select*frombookmis");

while(rs.next())

{

bookname=rs.getString("bookname");

bookid=rs.getString("num");

author=rs.getString("auther");

publisher=rs.getString("publisher");

count=rs.getInt("count");

Stringacount=Integer.toString(count);

Stringtemp="书名:

"+bookname+"编号:

"+bookid+"作者:

"+author+"出版社:

"+publisher+"数量:

"+acount;

alook.getList().add(temp);

alook.getJFrame();

alook.getList().add("\n\n\n\n");

}

}catch(Exceptione){

}

}

publicvoiddelete(){

try{result=0;

result=stmt.executeUpdate("deletefrombookmiswherebookname='"+temp+"'");

}catch(Exceptione){

}

if(result==1){

test1.setText("删除成功");

}

elsetest1.setText("删除失败,你输入的书名有误");

}

publicvoidupdate(){

try{

rs=stmt.executeQuery("select*frombookmiswherebookname='"+name+"'");

if(rs.next())

{

stmt.executeUpdate("deletefrombookmiswherebookname='"+name+"'");

jpane.setVisible(true);

}

else

{

jLabel.setText("请输入正确的书名");

}

}catch(SQLExceptione){

}

}

publicvoidaupdate(){

try{

result=stmt.executeUpdate("insertintobookmis(bookname,num,auther,publisher)values('"+bookname+"','"+bookid+"','"+author+"','"+publisher+"')");

}catch(SQLExceptione){

//TODO自动生成catch块

e.printStackTrace();

}

if(result==1){

jLabel.setText("修改成功");

}

elsejLabel.setText("修改失败");

}

publicvoidsendbook(){

try{

rs=stmt.executeQuery("select*frombookmiswherebookname='"+name+"'");

if(rs.next())

{

intbcount=rs.getInt("count");

if(bcount<=0){

jLabel.setText("书已经全部借完");return;

}

stmt.executeUpdate("updatebookmissetcount=count-1wherebookname='"+name+"'");

jLabel.setText("借阅成功");

}

else

{

jLabel.setText("没有这本书");

}

}catch(SQLExceptione){

e.printStackTrace();

}

}

publicvoidbackbook(){

try{

stmt.executeUpdate("updatebookmissetcount=count+1wherebookname='"+name+"'");

jLabel.setText("还书成功");

}catch(SQLExceptione){

}

}

MainMenu类

packageview;

import

import

import

import

import

import

import

importaccess.Access;

import

publicclassMainMenu{

privateJFramejFrame=null;//@jve:

decl-index=0:

visual-constraint="159,78"

privateJPaneljContentPane=null;

privateJLabeljLabel=null;

privateJTextFieldjTextField=null;

privateJLabeljLabel1=null;

privateJButtonjButton=null;

privateJButtonjButton1=null;

privateJPasswordFieldjPasswordField=null;

/**

*ThismethodinitializesjFrame

*

*@return

*/

publicJFramegetJFrame(){

if(jFrame==null){

jFrame=newJFrame();

jFrame.setSize(newDimension(461,320));

jFrame.setTitle("图书管理系统登陆界面");

jFrame.setContentPane(getJContentPane());

jFrame.setVisible(true);

}

returnjFrame;

}

/**

*ThismethodinitializesjContentPane

*

*@return

*/

privateJPanelgetJContentPane(){

if(jContentPane==null){

jLabel1=newJLabel();

jLabel1.setBounds(newRectangle(30,121,167,30));

jLabel1.setText("密码");

jLabel=newJLabel();

jLabel.setBounds(newRectangle(30,45,167,31));

jLabel.setText("用户名");

jContentPane=newJPanel();

jContentPane.setLayout(null);

jContentPane.add(jLabel,null);

jContentPane.add(getJTextField(),null);

jContentPane.add(jLabel1,null);

jContentPane.add(getJButton(),null);

jContentPane.add(getJButton1(),null);

jContentPane.add(getJPasswordField(),null);

}

returnjContentPane;

}

/**

*ThismethodinitializesjTextField

*

*@return

*/

privateJTextFieldgetJTextField(){

if(jTextField==null){

jTextField=newJTextField();

jTextField.setBounds(newRectangle(211,44,223,35));

}

returnjTextField;

}

/**

*ThismethodinitializesjButton

*

*@return

*/

privateJButtongetJButton(){

if(jButton==null){

jButton=newJButton();

jButton.setBounds(newRectangle(61,211,121,32));

jButton.setText("登陆");

jButton.addActionListener(newr(){

publicvoid

Stringusername=jTextField.getText();

Stringpassword=jPasswordField.getText();

Accessaccess=newAccess(username,password);

access.login();

jFrame.setVisible(false);

}

});

}

returnjButton;

}

/**

*ThismethodinitializesjButton1

*

*@return

*/

privateJButtongetJButton1(){

if(jButton1==null){

jButton1=newJButton();

jButton1.setBounds(newRectangle(269,210,139,32));

jButton1.setText("注册");

jButton1.addActionListener(new

publicvoid

Regsditregsdit=newRegsdit();

regsdit.getJFrame();

jFrame.setVisible(false);

}

});

}

returnjButton1;

}

/**

*ThismethodinitializesjPasswordField

*

*@return

*/

privateJPasswordFieldgetJPasswordField(){

if(jPasswordField==null){

jPasswordField=newJPasswordField();

jPasswordField.setBounds(newRectangle(211,121,225,29));

}

returnjPasswordField;

}

publicstaticvoidmain(Stringa[])

{

MainMenumainmenu=newMainMenu();

mainmenu.getJFrame();

}

}

MainCl类

packageview;

import

import

import

import

importja

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 国外设计风格

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1