軟件開(kāi)發(fā)項(xiàng)目總結(jié)報(bào)告
項(xiàng)目總結(jié)報(bào)告
項(xiàng)目題目:
課程階段:
學(xué)生姓名指導(dǎo)教師班級(jí)編號(hào)
提交日期北京翰子昂鄭州實(shí)訓(xùn)中心項(xiàng)目總結(jié)報(bào)告
目錄
第一章項(xiàng)目基本情況.............................................
1.11.1.11.1.21.21.2.11.2.21.2.3
項(xiàng)目概況.........................................................項(xiàng)目簡(jiǎn)介.........................................................指導(dǎo)老師.........................................................項(xiàng)目過(guò)程的基本回顧...............................................項(xiàng)目時(shí)間.........................................................主要項(xiàng)目?jī)?nèi)容.....................................................主要項(xiàng)目過(guò)程.....................................................
第二章項(xiàng)目任務(wù)與完成情況........................................
2.12.22.32.4
本人承擔(dān)的主要工作...............................................完成項(xiàng)目任務(wù)的技術(shù)方案與步驟.....................................項(xiàng)目中的問(wèn)題及解決方法...........................................項(xiàng)目任務(wù)的完成情況...............................................
第三章項(xiàng)目總結(jié).................................................
3.13.1.13.1.23.2
項(xiàng)目的心得.......................................................項(xiàng)目的收獲.......................................................項(xiàng)目的體會(huì).......................................................問(wèn)題與探討.......................................................
參考文獻(xiàn).......................................................致謝..........................................................
擴(kuò)展閱讀:軟件項(xiàng)目開(kāi)發(fā)總結(jié)報(bào)告模版
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
火車票系統(tǒng)的開(kāi)發(fā)
1引言
隨著人們生活水平和經(jīng)濟(jì)水平的提高,網(wǎng)絡(luò)科技的全球化的發(fā)展,出游和出差的頻率越來(lái)越多。這大大的激發(fā)了交通水平的發(fā)展。其中,火車這種又方便有便宜的交通工具作為人們的首選,火車站的客運(yùn)列車增加,客運(yùn)量也隨之增加。原有的售票的方式已經(jīng)不再能滿足旅客的需求了。為了方便旅客售票系統(tǒng)不僅僅只能售票也能夠了解列車的各種信息。這樣才能成為現(xiàn)在網(wǎng)絡(luò)社會(huì)的真的適應(yīng)者。
2需求分析
該售票系統(tǒng)是融合了火車票銷售、退票、列車管理、車票管理、售票員管理、列車管理信息,以及售票信息查詢?yōu)橐惑w的綜合系統(tǒng)。該系統(tǒng)主要編寫(xiě)的功能是列車和售票信息的查詢及售票功能。
2.1用戶
該系統(tǒng)主要有兩類用戶:管理員和售票員。管理員主要工作有車次管理,車票管理和售票員管理。對(duì)于每項(xiàng)功能都有添加,刪除和修改的功能。售票的主要工作是售票和退票。
2.2主要功能
該系統(tǒng)從功能方面可以分為四個(gè)方面:登錄。不管你是管理員還是售票員必須登錄以后才可以進(jìn)行系統(tǒng)允許的操作。當(dāng)然要登錄的管理員和售票員都必須是再數(shù)據(jù)庫(kù)中已經(jīng)發(fā)布的。基本設(shè)置:該模塊主要是修改售票員的相關(guān)信息,修改列車的相關(guān)信息和修改車票的相關(guān)信息。這一塊的功能只有管理員才可以操作。其他的售票員是不可以對(duì)他進(jìn)行操作的。售票和退票:這部分工作主要是售票員來(lái)操作的。售票員根據(jù)買(mǎi)票人員提出的要求進(jìn)行查詢。查詢的方式有兩種:一是根據(jù)車次查詢;一是根據(jù)目的地來(lái)查詢。退票主要是將已經(jīng)出售的車票在列車開(kāi)出之前再一次的返回到數(shù)據(jù)庫(kù)中,并繼續(xù)出售。
列車和車票查詢;當(dāng)需要查詢列車信息或者是車票信息是所做的操作。
2.3基本流程
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
3開(kāi)發(fā)過(guò)程
3.1內(nèi)容
該程序包括三個(gè)部分?jǐn)?shù)據(jù)庫(kù)的設(shè)計(jì)、通用模塊的實(shí)現(xiàn)、各個(gè)模塊的實(shí)現(xiàn)。
3.1.1數(shù)據(jù)庫(kù)的設(shè)計(jì):
將本系統(tǒng)所需的所有的數(shù)據(jù)都存儲(chǔ)到數(shù)據(jù)庫(kù)中。需要在數(shù)據(jù)庫(kù)中管理員表、
售票員表、列車信息表和車票信息表。如圖所示:
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
管理員表:
售票員表:
列車信息表:
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
車票信息表:
3.1.2通用模塊的實(shí)現(xiàn):
通用模塊為了減少代碼的重復(fù)。在該系統(tǒng)中,對(duì)經(jīng)常使用的操作進(jìn)行封裝,如將多次需要調(diào)用的數(shù)據(jù)庫(kù)和操作數(shù)庫(kù)的增、刪、改和查等操作進(jìn)行封裝。使代碼有很好的重用性,即使出現(xiàn)錯(cuò)誤也很容易調(diào)試。如本程序中的Conn.java
importjava.sql.*;publicclassConn{
privatestaticConnectioncon;
privatestaticfinalStringDRIVER="com.mysql.jdbc.Driver";
privatestaticfinalStringURL="jdbc:mysql://localhost:3306/newdatabase";privatestaticfinalStringNAME="root";
privatestaticfinalStringPASSWORD="021702190804";static{}
publicstaticConnectiongetConnection(){}
publicstaticvoidcloseCon(Connectioncon){
try{
if(con!=null)
con.close();
try{
con=DriverManager.getConnection(URL,NAME,PASSWORD);}catch(SQLExceptione){}
returncon;
e.printStackTrace();try{}
Class.forName(DRIVER);e.printStackTrace();
}catch(ClassNotFoundExceptione){
}catch(SQLExceptione){
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
}}publicstaticvoidclosePt(PreparedStatementpt){}
publicstaticvoidcloseRs(ResultSetrs){}
try{}
if(rs!=null)
rs.close();
try{}
if(pt!=null)
pt.close();
}e.printStackTrace();
}catch(Exceptione){
e.printStackTrace();
}catch(Exceptione){
e.printStackTrace();
用戶登錄界面的設(shè)計(jì)、主界面的設(shè)計(jì)、基本設(shè)置模塊、銷售及退票模塊和列車及車票查詢模塊。
用戶登錄模塊:該部分是通過(guò)設(shè)計(jì)login.java來(lái)實(shí)現(xiàn)的。這部分代碼的作用是用戶首先選擇自己的登錄的是管理員還是售票員,然后輸入賬號(hào)和密碼。單擊登錄,用戶先判斷用戶登錄的類型,然后給sql變量賦SQL語(yǔ)句值,系統(tǒng)調(diào)用DAO.java類的login()傳入sql變量。.Login代碼是:
importorg.eclipse.swt.SWT;importorg.eclipse.swt.events.*;importorg.eclipse.swt.graphics.Image;importorg.eclipse.swt.layout.*;importorg.eclipse.swt.widgets.*;
importcom.huizhi.dao.DAO;publicclassLogin{
privateTextnameText;privateTextpassText;privateCombocombo;privateStringtype;
privateDisplaydisplay=newDisplay();privateShellshell=newShell(display);publicLogin(){
FormLayoutlayout=newFormLayout();
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
layout.marginHeight=40;
layout.marginWidth=40;shell.setLayout(layout);shell.setText("login");
Imageimage=newImage(display,"2.jpg");shell.setBackgroundImage(image);setUIControl();shell.pack();shell.open();
while(!shell.isDisposed()){if(!display.readAndDispatch())display.sleep();}
display.dispose();}
privatevoidsetUIControl(){
Labelusername=newLabel(shell,SWT.NONE);username.setText("username");
nameText=newText(shell,SWT.SINGLE|SWT.BORDER);
Labelpassword=newLabel(shell,SWT.NONE);
password.setText("password");
passText=newText(shell,SWT.SINGLE|SWT.BORDER|SWT.PASSWORD);//passText.setEchoChar("*");
Labelselect=newLabel(shell,SWT.NONE);select.setText("select");
Buttonsubmit=newButton(shell,SWT.PUSH);submit.setText("login");
submit.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(SelectionEvente){
type=combo.getText();
Stringname=nameText.getText();Stringpass=passText.getText();Stringsql=null;booleanflag=false;
MessageBoxbox=newMessageBox(shell,SWT.OK);if("".equals(type)||"".equals(name)||"".equals(pass)){}
box.setMessage("pleaseinputalltheinformation");box.open();return;
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
DAOdao=newDAO();
if("users".equals(type)){sql="select*fromuserswhereusername=""+name+""andpassword=""+pass+""";}elseif("admin".equals(type)){
sql="select*fromadminwhereusername=""+name+""and
password=""+pass+""";
}flag=dao.login(sql);if(flag){
shell.dispose();
newMain(type);}else{}
box.setMessage("wrongnameorpassword");box.open();
}});
Buttonreset=newButton(shell,SWT.PUSH);reset.setText("cancel");
Stringvalue[]={"users","admin"};
combo=newCombo(shell,SWT.DROP_DOWN);combo.setItems(value);
FormDatadata=newFormData();data.top=newFormAttachment(30,0);username.setLayoutData(data);
data=newFormData();
data.top=newFormAttachment(username,0,SWT.CENTER);data.left=newFormAttachment(username,10,SWT.RIGHT);nameText.setLayoutData(data);
data=newFormData();
data.top=newFormAttachment(select,0,SWT.CENTER);data.left=newFormAttachment(select,10,SWT.RIGHT);combo.setLayoutData(data);
data=newFormData();
data.top=newFormAttachment(username,10,SWT.BOTTOM);password.setLayoutData(data);
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
data=newFormData();
data.top=newFormAttachment(password,0,SWT.CENTER);data.left=newFormAttachment(nameText,0,SWT.LEFT);passText.setLayoutData(data);
data=newFormData();
data.top=newFormAttachment(password,10,SWT.BOTTOM);submit.setLayoutData(data);
data=newFormData();
data.top=newFormAttachment(submit,0,SWT.CENTER);data.left=newFormAttachment(submit,20,SWT.RIGHT);reset.setLayoutData(data);}
publicstaticvoidmain(String[]args){newLogin();
}}DAO.java的login()代碼:
publicbooleanlogin(Stringsql){booleanflag=false;con=Conn.getConnection();try{
pt=con.prepareStatement(sql);rs=pt.executeQuery();if(rs.next()){flag=true;}
}catch(SQLExceptione){e.printStackTrace();}finally{Conn.closeRs(rs);}
Conn.closePt(pt);Conn.closeCon(con);
returnflag;}圖示為;
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
實(shí)現(xiàn)主界面:
importorg.eclipse.swt.*;
importorg.eclipse.swt.widgets.*;importorg.eclipse.swt.layout.*;importorg.eclipse.swt.events.*;
publicclassMain{
privateStringtype;
Displaydisplay=Display.getCurrent();
Shellshell=newShell(display);publicMain(Stringtype){this.type=type;shell.setText("Trainticketingsystem");
shell.setLayout(newFillLayout());
Menumenu=newMenu(shell,SWT.BAR);//第一個(gè)菜單
MenuItembasic=newMenuItem(menu,SWT.CASCADE);basic.setText("BasicSettings");if("users".equals(type)){}
basic.setEnabled(false);
Menufilemenu=newMenu(shell,SWT.DROP_DOWN);MenuItemtrain=newMenuItem(filemenu,SWT.PUSH);train.setText("TrainsManagement");
train.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(SelectionEvente){
}newTrainManage();
});
MenuItemticket=newMenuItem(filemenu,SWT.PUSH);ticket.setText("TicketsManagement");
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
ticket.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(SelectionEvente){newTicketManage();}});
MenuItemusers=newMenuItem(filemenu,SWT.PUSH);users.setText("UsersManagement");
users.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(SelectionEvente){
newUsersManage();
}});
MenuItemexit=newMenuItem(filemenu,SWT.PUSH);exit.setText("quit");
basic.setMenu(filemenu);
exit.addSelectionListener(newSelectionAdapter(){
}publicvoidwidgetSelected(SelectionEvente){display.dispose();
});
//第二個(gè)菜單
MenuItemmarket=newMenuItem(menu,SWT.CASCADE);market.setText("SalesandRefunds");
MenueditMenu=newMenu(shell,SWT.DROP_DOWN);
MenuItemmarketItem=newMenuItem(editMenu,SWT.PUSH);marketItem.setText("SalesTickets");
marketItem.addSelectionListener(newSelectionAdapter(){
publicvoidwidgetSelected(SelectionEvente){newXiaosTicket();}
});
MenuItemrefundItem=newMenuItem(editMenu,SWT.PUSH);refundItem.setText("RefundsTickets");market.setMenu(editMenu);
refundItem.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(SelectionEvente){
newTuiTicket();
}});
//第三個(gè)菜單
MenuItemfind=newMenuItem(menu,SWT.CASCADE);find.setText("TrainsandTicketsquery");
MenutaiMenu=newMenu(shell,SWT.DROP_DOWN);MenuItemtrainFind=newMenuItem(taiMenu,SWT.PUSH);
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
trainFind.setText("Trainsquery");
trainFind.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(SelectionEvente){newFindTrain();}});
MenuItemticketFind=newMenuItem(taiMenu,SWT.PUSH);ticketFind.setText("Ticketquery");find.setMenu(taiMenu);
ticketFind.addSelectionListener(newSelectionAdapter(){
publicvoidwidgetSelected(SelectionEvente){newFindTicket();
}});
shell.setMenuBar(menu);shell.setSize(500,400);
shell.open();
while(!shell.isDisposed()){if(!display.readAndDispatch())
display.sleep();
}display.dispose();
}}圖示為:
基本設(shè)置模塊包括車次管理,車票管理和售票員管理。
車次管理主要是是對(duì)于列車的增加,刪除和修改等操作。其中包括它的相關(guān)的信息等。它是由TrainManagement.java.代碼如下:importjava.util.List;
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
importorg.eclipse.swt.SWT;
importorg.eclipse.swt.events.*;importorg.eclipse.swt.layout.*;importorg.eclipse.swt.widgets.*;
importcom.huizhi.dao.DAO;importcom.huizhi.vo.Train;
publicclassTrainManage{
Displaydisplay=Display.getCurrent();Shelltmshell=newShell(display);
finalTabletable=newTable(tmshell,SWT.SINGLE|SWT.H_SCROLL|SWT.V_SCROLL|SWT.H_SCROLL|SWT.BORDER|SWT.FULL_SELECTION);TrainManagetm=this;
publicTrainManage(){
RowLayoutrowLayout=newRowLayout();rowLayout.pack=true;
rowLayout.wrap=true;
rowLayout.justify=false;
rowLayout.marginTop=20;
tmshell.setLayout(rowLayout);
finalTableColumncolumn1=newTableColumn(table,SWT.LEFT);column1.setText("TrainID");
column1.setWidth(80);
finalTableColumncolumn2=newTableColumn(table,SWT.LEFT);column2.setText("TrainNum");column2.setWidth(80);
finalTableColumncolumn3=newTableColumn(table,SWT.LEFT);column3.setText("TrainType");column3.setWidth(80);
finalTableColumncolumn4=newTableColumn(table,SWT.LEFT);column4.setText("Starting");
column4.setWidth(80);
finalTableColumncolumn5=newTableColumn(table,SWT.LEFT);column5.setText("startingTime");
column5.setWidth(80);
finalTableColumncolumn6=newTableColumn(table,SWT.LEFT);column6.setText("terminal");column6.setWidth(80);
finalTableColumncolumn7=newTableColumn(table,SWT.LEFT);column7.setText("terminalTime");column7.setWidth(80);
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
finalTableColumncolumn8=newTableColumn(table,SWT.LEFT);column8.setText("iskongtiao");column8.setWidth(80);
finalTableColumncolumn9=newTableColumn(table,SWT.LEFT);column9.setText("price");
column9.setWidth(80);
finalTableColumncolumn10=newTableColumn(table,SWT.LEFT);column10.setText("middleStation");column10.setWidth(80);
finalTableColumncolumn11=newTableColumn(table,SWT.LEFT);column11.setText("yzNum");column11.setWidth(80);
finalTableColumncolumn12=newTableColumn(table,SWT.LEFT);column12.setText("rzNum");
column12.setWidth(80);
finalTableColumncolumn13=newTableColumn(table,SWT.LEFT);column13.setText("ywNum");column13.setWidth(80);
finalTableColumncolumn14=newTableColumn(table,SWT.LEFT);column14.setText("rwNum");column14.setWidth(80);
table.setHeaderVisible(true);table.setLinesVisible(true);freshData();
table.setSize(800,200);
Buttonadd=newButton(tmshell,SWT.PUSH);add.setText("addtrains");
add.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(SelectionEvente){newAddTrain(tm);}});
Buttonupdate=newButton(tmshell,SWT.PUSH);update.setText("modify");
update.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(SelectionEvente){
TableItem[]selection=table.getSelection();
TableItemselectedRow=selection[0];Traintrain=newTrain();
train.setId(Integer.parseInt(selectedRow.getText(0)));
train.setTrainNum(selectedRow.getText(1));train.setTrainType(selectedRow.getText(2));train.setStarting(selectedRow.getText(3));
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
train.setStartingTime(selectedRow.getText(4));train.setTerminal(selectedRow.getText(5));
train.setTerminalTime(selectedRow.getText(6));train.setIskongTiao(selectedRow.getText(7));
train.setPrice(Float.parseFloat(selectedRow.getText(8)));train.setMiddleStation(selectedRow.getText(9));
train.setYzNum(Integer.parseInt(selectedRow.getText(10)));
train.setRzNum(Integer.parseInt(selectedRow.getText(11)));train.setYwNum(Integer.parseInt(selectedRow.getText(12)));
train.setRwNum(Integer.parseInt(selectedRow.getText(13)));newUpdateTrain(train,tm);
}});
Buttondelete=newButton(tmshell,SWT.PUSH);
delete.setText("cancel");
delete.addSelectionListener(newSelectionAdapter(){
box=new
publicvoidwidgetSelected(SelectionEvente){MessageBox
MessageBox(tmshell,SWT.YES|SWT.NO);
box.setMessage("Areyousuretocancel?");
intnum=box.open();if(num==128)
return;
TableItem[]selection=table.getSelection();TableItemselectedRow=selection[0];DAOdao=newDAO();Stringsql="delete
from
train
where
id="+selectedRow.getText(0)+"";
inti=dao.update(sql);
if(i>0){
box.setMessage("succeed");box.open();
table.remove(table.getSelectionIndex());}else{}}});
box.setMessage("failure");box.open();
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
tmshell.setSize(1200,400);
tmshell.setText("trainManagement");tmshell.open();
while(!tmshell.isDisposed()){
if(!display.readAndDispatch())
display.sleep();}
tmshell.dispose();}
publicvoidfreshData(){
table.removeAll();try{
DAOdao=newDAO();
Listlist=dao.getAllTrain();intnumber=list.size();
for(inti=0;i武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
e.printStackTrace();
}finally{
Conn.closePt(pt);Conn.closeCon(con);}returni;
}publicListgetAllTrain(){
Listlist=newArrayList();con=Conn.getConnection();try{
pt=con.prepareStatement("select*fromtrain");rs=pt.executeQuery();while(rs.next()){
Traintrain=newTrain();
train.setId(rs.getInt(1));
train.setTrainNum(rs.getString(2));train.setTrainType(rs.getString(3));train.setStarting(rs.getString(4));
train.setStartingTime(rs.getString(5));train.setTerminal(rs.getString(6));
train.setTerminalTime(rs.getString(7));train.setIskongTiao(rs.getString(8));train.setPrice(rs.getFloat(9));
train.setMiddleStation(rs.getString(10));train.setYzNum(rs.getInt(11));train.setRzNum(rs.getInt(12));train.setYwNum(rs.getInt(13));
train.setRwNum(rs.getInt(14));list.add(train);}
}catch(SQLExceptione){e.printStackTrace();}finally{
Conn.closeRs(rs);
Conn.closePt(pt);Conn.closeCon(con);
}returnlist;
}其中的update的功能是,首先連接數(shù)據(jù)庫(kù),然后用傳遞過(guò)來(lái)的SQl語(yǔ)句在列表中刪除某輛列車的信息。getAllTrain()方法是顯示所有的列車的信息。圖示如下:
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
在車次管理中的對(duì)于列車信息添加的功能是通過(guò)AddTrain.java來(lái)實(shí)現(xiàn)的。代碼如下:
importorg.eclipse.swt.SWT;importorg.eclipse.swt.events.*;importorg.eclipse.swt.layout.*;importorg.eclipse.swt.widgets.*;importcom.huizhi.dao.DAO;
publicclassAddTrain{
Displaydisplay=Display.getCurrent();Shelltmshell=newShell(display);TrainManagetrainmanage=null;
publicAddTrain(TrainManagetm){trainmanage=tm;
GridLayoutgridlayout=newGridLayout();tmshell.setText("addtrainsinformation");
gridlayout.numColumns=2;
gridlayout.makeColumnsEqualWidth=true;
tmshell.setLayout(gridlayout);
GridDatagd=newGridData(GridData.FILL_BOTH);Labell=newLabel(tmshell,SWT.LEFT);l.setText("trainNum");
l.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTexttrainNum=newText(tmshell,SWT.NONE);trainNum.setSize(50,60);trainNum.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
Labell1=newLabel(tmshell,SWT.LEFT);l1.setText("trainType");
l1.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTexttrainType=newText(tmshell,SWT.LEFT);
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
trainType.setSize(30,40);
trainType.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell2=newLabel(tmshell,SWT.LEFT);l2.setText("starting");l2.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextstarting=newText(tmshell,SWT.LEFT);starting.setSize(30,40);starting.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell3=newLabel(tmshell,SWT.LEFT);l3.setText("startingtime");l3.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextstartingTime=newText(tmshell,SWT.LEFT);startingTime.setSize(30,40);startingTime.setLayoutData(gd);
Labell4=newLabel(tmshell,SWT.LEFT);l4.setText("terminal");l4.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextterminal=newText(tmshell,SWT.LEFT);terminal.setSize(30,40);
terminal.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell5=newLabel(tmshell,SWT.LEFT);l5.setText("terminaltime");
l5.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextterminalTime=newText(tmshell,SWT.LEFT);terminalTime.setSize(30,40);terminalTime.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell6=newLabel(tmshell,SWT.LEFT);l6.setText("iskongtiao");
l6.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextiskongTiao=newText(tmshell,SWT.LEFT);
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
iskongTiao.setSize(30,40);
iskongTiao.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell7=newLabel(tmshell,SWT.LEFT);l7.setText("price");l7.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextprice=newText(tmshell,SWT.LEFT);price.setSize(30,40);price.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell8=newLabel(tmshell,SWT.LEFT);l8.setText("middleStation");l8.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextmiddleStation=newText(tmshell,SWT.LEFT);middleStation.setSize(30,40);middleStation.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell9=newLabel(tmshell,SWT.LEFT);l9.setText("yzNum");l9.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextyzNum=newText(tmshell,SWT.LEFT);yzNum.setSize(30,40);yzNum.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell10=newLabel(tmshell,SWT.LEFT);l10.setText("rzNum");l10.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextrzNum=newText(tmshell,SWT.LEFT);rzNum.setSize(30,40);rzNum.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell11=newLabel(tmshell,SWT.LEFT);l11.setText("ywNum");l11.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
finalTextywNum=newText(tmshell,SWT.LEFT);ywNum.setSize(30,40);ywNum.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell12=newLabel(tmshell,SWT.LEFT);l12.setText("rwNum");
l12.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);finalTextrwNum=newText(tmshell,SWT.LEFT);rwNum.setSize(30,40);rwNum.setLayoutData(gd);
Buttonb=newButton(tmshell,SWT.LEFT);b.setText("add");
b.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(SelectionEvente){
MessageBoxbox=newMessageBox(tmshell,SWT.OK);
if("".equals(trainNum.getText())||"".equals(trainType.getText())||"".equals(starting.getText())
||"".equals(startingTime.getText())||"".equals(terminal.getText())||"".equals(terminalTime.getText())
||"".equals(iskongTiao.getText())||"".equals(price.getParent())||"".equals(middleStation.getText())||"".equals(yzNum.getText())
||"".equals(rzNum.getText())||"".equals(ywNum.getText())||"".equals(rwNum.getText())){
box.setMessage("pleaseinputtherightinformation");
box.open();
return;}
DAOdao=newDAO();String
sql="insert
into
train(trainNum,trainType,starting1,startingTime,terminal,terminalTime,iskongTiao,price,"+
"middleStation,yzNum,rzNum,ywNum,rwNum)values(""+trainNum.getText()+"",""+trainType.getText()+"",""+starting.getText()+"","+
"""+startingTime.getText()+"",""+terminal.getText()+"",""+terminalTime.getText()+"",""+iskongTiao.getText()+"","+
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
"""+price.getText()+"",""+middleStation.getText()+"",""+yzNum.getText()+"",""+rzNum.getText()+"",""+ywNum.getText()+"",""+rwNum.getText()+"")";
inti=dao.update(sql);
}if(i>0){
box.setMessage("add");}
box.open();fresh();
});
Buttonb1=newButton(tmshell,SWT.LEFT);b1.setText("quit");
b1.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(SelectionEvente){tmshell.setVisible(false);}});
tmshell.layout();
tmshell.setSize(500,450);
tmshell.open();
while(!tmshell.isDisposed()){
if(!display.readAndDispatch())display.sleep();
}tmshell.dispose();
}publicvoidfresh(){
trainmanage.freshData();}}圖示為:
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
修改列車功能是在UpdateTrain.java.類中實(shí)現(xiàn)的。代碼如下:importorg.eclipse.swt.SWT;
importorg.eclipse.swt.events.*;importorg.eclipse.swt.layout.*;importorg.eclipse.swt.widgets.*;
importcom.huizhi.dao.DAO;importcom.huizhi.vo.Train;
publicclassUpdateTrain{privateTraintrain;
Displaydisplay=Display.getCurrent();Shellutrainshell=newShell(display);
TrainManagetrainmanage=null;
publicUpdateTrain(Traintrain,TrainManagetm){
this.trainmanage=tm;
this.train=train;
GridLayoutgridlayout=newGridLayout();
utrainshell.setText("modifytraininformation");gridlayout.numColumns=2;
gridlayout.makeColumnsEqualWidth=true;utrainshell.setLayout(gridlayout);
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
GridDatagd=newGridData(GridData.FILL_BOTH);Labelll=newLabel(utrainshell,SWT.LEFT);ll.setText("trainID");ll.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextnum=newText(utrainshell,SWT.NONE);num.setText(Integer.toString(train.getId()));num.setEnabled(false);num.setSize(50,60);num.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell=newLabel(utrainshell,SWT.LEFT);l.setText("TrainNum");
l.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTexttrainNum=newText(utrainshell,SWT.NONE);trainNum.setText(train.getTrainNum());trainNum.setSize(50,60);trainNum.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell1=newLabel(utrainshell,SWT.LEFT);l1.setText("TrainType");l1.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTexttrainType=newText(utrainshell,SWT.LEFT);trainType.setText(train.getTrainType());trainType.setSize(30,40);trainType.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell2=newLabel(utrainshell,SWT.LEFT);l2.setText("starting");
l2.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextstarting=newText(utrainshell,SWT.LEFT);starting.setText(train.getStarting());starting.setSize(30,40);starting.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell3=newLabel(utrainshell,SWT.LEFT);l3.setText("startingTime");
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
l3.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextstartingTime=newText(utrainshell,SWT.LEFT);startingTime.setText(train.getStartingTime());startingTime.setSize(30,40);startingTime.setLayoutData(gd);
Labell4=newLabel(utrainshell,SWT.LEFT);l4.setText("terminal");l4.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextterminal=newText(utrainshell,SWT.LEFT);terminal.setText(train.getTerminal());terminal.setSize(30,40);terminal.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell5=newLabel(utrainshell,SWT.LEFT);l5.setText("terminalTime");
l5.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextterminalTime=newText(utrainshell,SWT.LEFT);terminalTime.setText(train.getTerminalTime());terminalTime.setSize(30,40);terminalTime.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell6=newLabel(utrainshell,SWT.LEFT);l6.setText("iskongtiao");l6.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextiskongTiao=newText(utrainshell,SWT.LEFT);iskongTiao.setText(train.getIskongTiao());iskongTiao.setSize(30,40);iskongTiao.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell7=newLabel(utrainshell,SWT.LEFT);l7.setText("price");
l7.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextprice=newText(utrainshell,SWT.LEFT);price.setText(Float.toString(train.getPrice()));price.setSize(30,40);
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
price.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell8=newLabel(utrainshell,SWT.LEFT);l8.setText("middleStation");
l8.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextmiddleStation=newText(utrainshell,SWT.LEFT);middleStation.setText(train.getMiddleStation());middleStation.setSize(30,40);middleStation.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);Labell9=newLabel(utrainshell,SWT.LEFT);l9.setText("yzNum");l9.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextyzNum=newText(utrainshell,SWT.LEFT);yzNum.setText(Integer.toString(train.getYzNum()));yzNum.setSize(30,40);yzNum.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
Labell10=newLabel(utrainshell,SWT.LEFT);l10.setText("rzNum");
l10.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextrzNum=newText(utrainshell,SWT.LEFT);rzNum.setText(Integer.toString(train.getRzNum()));rzNum.setSize(30,40);rzNum.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
Labell11=newLabel(utrainshell,SWT.LEFT);l11.setText("ywNum");l11.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextywNum=newText(utrainshell,SWT.LEFT);ywNum.setText(Integer.toString(train.getYwNum()));ywNum.setSize(30,40);ywNum.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
Labell12=newLabel(utrainshell,SWT.LEFT);
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
l12.setText("rwNum");
l12.setLayoutData(gd);
gd=newGridData(GridData.FILL_BOTH);
finalTextrwNum=newText(utrainshell,SWT.LEFT);rwNum.setText(Integer.toString(train.getRwNum()));rwNum.setSize(30,40);rwNum.setLayoutData(gd);
Buttonb=newButton(utrainshell,SWT.LEFT);b.setText("modify");
b.addSelectionListener(newSelectionAdapter(){
publicvoidwidgetSelected(SelectionEvente){
MessageBoxbox=newMessageBox(utrainshell,SWT.OK);
if("".equals(trainNum.getText())||"".equals(trainType.getText())||"".equals(starting.getText())
||"".equals(startingTime.getText())||"".equals(terminal.getText())||"".equals(terminalTime.getText())
||"".equals(iskongTiao.getText())||"".equals(price.getText())||"".equals(middleStation.getText())||"".equals(yzNum.getText())
||"".equals(rzNum.getText())||"".equals(ywNum.getText())||"".equals(rwNum.getText())){
box.setMessage("pleaseinputrightinformationthenmodify");
box.open();
return;}
DAOdao=newDAO();
Stringsql="updatetrainsettrainNum=""+trainNum.getText()+"",trainType=""+trainType.getText()+"",starting1=""+starting.getText()+"","+
"startingTime=""+startingTime.getText()+"",terminal=""+terminal.getText()+"",terminalTime=""+terminalTime.getText()+"",iskongTiao=""+iskongTiao.getText()+"","+
"price=""+price.getText()+"",middleStation=""+middleStation.getText()+"",yzNum=""+yzNum.getText()+"",rzNum=""+rzNum.getText()+"",ywNum=""+ywNum.getText()+"",rwNum=""+rwNum.getText()+""whereid=""+num.getText()+""";
inti=dao.update(sql);if(i>0){
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
box.setMessage("succeed");
box.open();fresh();}else{
box.setMessage("failure");box.open();}
}});
Buttonb1=newButton(utrainshell,SWT.LEFT);b1.setText("quit");
b1.addSelectionListener(newSelectionAdapter(){
publicvoidwidgetSelected(SelectionEvente){utrainshell.setVisible(false);
}});
utrainshell.layout();
utrainshell.setSize(500,450);utrainshell.open();
while(!utrainshell.isDisposed()){if(!display.readAndDispatch())display.sleep();}
utrainshell.dispose();}
publicvoidfresh(){
trainmanage.freshData();}}
車票管理主要包括對(duì)車票的增加,刪除和修改的操作。由TicketManagement.java實(shí)現(xiàn)。代碼類似上面的:(具體看壓縮包)。其中的查詢列車表和售票表調(diào)用的DAO.java類中selectTicket()方法。圖示為:
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
售票員管理是對(duì)售票員進(jìn)行增加、刪除和修改進(jìn)行操作。由UserMannage.java類來(lái)實(shí)現(xiàn)。代碼類似以上。在該類中調(diào)用了DAO.java類中g(shù)etAllUser()方法。圖示為:
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
售票及退票模塊包括兩部分:火車售票和退票。售票系統(tǒng)是xiaosTickect.java實(shí)現(xiàn)的。圖示如下:
退票是售票員根據(jù)用戶提供的車票信息在系統(tǒng)中進(jìn)行售票。主要是由TuiTicket.java來(lái)實(shí)現(xiàn)的。在該類中涉及到DAO.java類中的selectTrain()方法.圖示如下:
列車及車票查詢系統(tǒng)主要功能包括兩部分:查詢列車信息和查詢車票信息.有FindTrain.Java和FindTicket.java實(shí)現(xiàn).圖示如下:
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
4學(xué)習(xí)心得
我是再?zèng)]有接觸eclipse之前就接觸了java,我自己都先用記事本編寫(xiě)java程序,然后在doc下進(jìn)行編譯和運(yùn)行。后來(lái)安裝了ecplise這個(gè)集成環(huán)境,但是只把它當(dāng)成一個(gè)運(yùn)行java的集成環(huán)境。
后來(lái)經(jīng)過(guò)開(kāi)發(fā)工具的學(xué)習(xí)和相關(guān)書(shū)籍的查看,開(kāi)始深入的理解了什么是ecplise。其實(shí)整個(gè)ecplise體系結(jié)構(gòu)就像一個(gè)大的拼圖,可以不斷地向其中添加插件,同時(shí)在現(xiàn)有的插件上還可以再增加插件。可以說(shuō),在ecplise中一切都是插件。這里有一張圖片很形象的說(shuō)明了ecplise的體系結(jié)構(gòu):
在我學(xué)習(xí)ecplise的工程中,我覺(jué)得它跟一般的軟件比起來(lái)有很大的優(yōu)勢(shì):在編寫(xiě)代碼的過(guò)程中,如果有編譯錯(cuò)誤的話系統(tǒng)馬上會(huì)提醒,我們很容易就會(huì)會(huì)發(fā)現(xiàn)。而且它會(huì)給你提供一些解決問(wèn)題的方法,雖然有些解決方法有一些笨,但是這對(duì)于一些想我們這樣的初學(xué)者來(lái)說(shuō),無(wú)疑是雪中送炭。而且在編寫(xiě)代碼的過(guò)程中,我們使用一些類的對(duì)象的方法的過(guò)程中系統(tǒng)給予一定的提示。這大大的減少了我們出錯(cuò)的機(jī)會(huì),并且我們也可以順便了解一下該類的其他方法。加快我們的學(xué)習(xí)進(jìn)度。
武漢理工大學(xué)《軟件開(kāi)發(fā)工具》論文報(bào)告
對(duì)于ecplise的具體的功能的學(xué)習(xí)感悟:對(duì)于調(diào)試器板塊該環(huán)境提供了很多的功能包括單步執(zhí)行、設(shè)置斷點(diǎn)和值、檢查變量和值以及暫掛和恢復(fù)線程的能力。在我們課堂上只學(xué)習(xí)了本地調(diào)試中的斷點(diǎn)。斷點(diǎn)提供了一種強(qiáng)大的工具,使我們能夠在需要的時(shí)間和位置掛起執(zhí)行。與逐句或逐條指令的檢查代碼不同的是,可以讓程序一直執(zhí)行,直到遇到斷點(diǎn)。然后開(kāi)始調(diào)試。這大大的加快了調(diào)試過(guò)程。沒(méi)有這個(gè)功能,調(diào)試大型程序幾乎不能完成。至于遠(yuǎn)程的調(diào)試對(duì)于現(xiàn)在學(xué)習(xí)的程度來(lái)說(shuō)有一點(diǎn)難。所以先放棄,以后再研究。
對(duì)于JUnit,包括模塊接口測(cè)試、局部數(shù)據(jù)結(jié)構(gòu)測(cè)試、路經(jīng)測(cè)試、錯(cuò)誤處理測(cè)試、邊界測(cè)試。它的核心類主要有jnuit.framework包下的TestCase、Testsuite和TestResult,junit.runnier包下的BaseTestRunner類。而我們現(xiàn)在用到的只有斷言Assert。在這里有一點(diǎn)原則是需要注意的它的測(cè)試名要很容易與應(yīng)用類區(qū)分開(kāi)來(lái)。
我覺(jué)得學(xué)會(huì)用ecplise來(lái)創(chuàng)建的基于SWT的圖形應(yīng)用程序十分的重要。這個(gè)要源于它的開(kāi)發(fā)緣由。在這之前,使用的awt是原生窗口部件,但是它一直未能突破LCD。為了解決這個(gè)問(wèn)題,又開(kāi)發(fā)了swing。它使用的是仿真窗口部件,不存在LCD問(wèn)題。但是消耗太多的內(nèi)存等。為了徹底解決
上述問(wèn)題,IBM開(kāi)發(fā)了SWT。在基于Windows的ecplise中,SWT通過(guò)DLL形式的本地庫(kù)與操作系統(tǒng)交互;在UNIX下,SWT可通過(guò)的GTK運(yùn)行。
最近的學(xué)習(xí)和看書(shū),讓我覺(jué)得自己的真的就像在軟件的最頂層。自己現(xiàn)在學(xué)習(xí)的東西在軟件
中真的是基礎(chǔ)中的基礎(chǔ)。我們還有很長(zhǎng)的路要走。真的要加油,好好學(xué)習(xí)啊!
5.參考文獻(xiàn)
[1]java核心技術(shù)卷1:基礎(chǔ)知識(shí)葉乃文鄺勁筠杜永萍201*.5機(jī)械工業(yè)出版社[2]eclipse3.0程序開(kāi)發(fā)技術(shù)詳解吳越勝李新磊201*.10清華大學(xué)出版社
友情提示:本文中關(guān)于《軟件開(kāi)發(fā)項(xiàng)目總結(jié)報(bào)告》給出的范例僅供您參考拓展思維使用,軟件開(kāi)發(fā)項(xiàng)目總結(jié)報(bào)告:該篇文章建議您自主創(chuàng)作。
來(lái)源:網(wǎng)絡(luò)整理 免責(zé)聲明:本文僅限學(xué)習(xí)分享,如產(chǎn)生版權(quán)問(wèn)題,請(qǐng)聯(lián)系我們及時(shí)刪除。