版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
一、設(shè)計(jì)目的… 2二、功能介紹… 2三、程序流程… 2四、設(shè)計(jì)步驟… 3五、設(shè)計(jì)總結(jié)… 7六、程序清單… 8七、參考文獻(xiàn)… 17一、設(shè)計(jì)目的于面對(duì)對(duì)象的理論進(jìn)行系統(tǒng)設(shè)計(jì)經(jīng)過中的諸多詳細(xì)問題有感性的認(rèn)識(shí)和深入的理解;進(jìn)而提升學(xué)生的學(xué)習(xí)愛好為其將來順利進(jìn)入畢業(yè)環(huán)節(jié)作必要的預(yù)備。二、功能介紹具有新用戶注冊(cè)功能。具有注冊(cè)用戶登錄功能。具有職工工資的錄入功能,要求只錄入工資各項(xiàng),自動(dòng)計(jì)算每個(gè)職工工資總額。具有數(shù)據(jù)查詢功能,能夠?qū)崿F(xiàn)查詢?nèi)啃畔⒑桶礂l件執(zhí)行查詢。具有按條件刪除數(shù)據(jù)功能。三、程序流程開頭開頭新用戶登錄?YN注冊(cè)新用戶輸入用戶名和密碼進(jìn)入系統(tǒng)選擇操作錄入功能查找功能刪除功能向數(shù)據(jù)庫添加記錄可按職工號(hào)查詢或查詢所有數(shù)據(jù)按選中行的行號(hào)刪除數(shù)據(jù)結(jié)束四、設(shè)計(jì)步驟、登陸界面輸入賬號(hào)和密碼,點(diǎn)擊登錄就會(huì)進(jìn)入職工Stringuser,booleanbool4.1、職工工資管理系統(tǒng)登陸成功后進(jìn)入的界面如圖4.2,界面有增刪改查的功能。widgetSelected()DBHelperdbupdate()query()方式。4.2、全部查找功能點(diǎn)擊右邊的查詢按鈕能夠查找出所有員工的工資信息如圖4.3,經(jīng)過自己封裝DBHelperdb,sqlgetString()方式導(dǎo)出從數(shù)據(jù)庫中查找到的數(shù)據(jù),所得工資=根本工資+職位提成-50*-100*曠工天數(shù),經(jīng)過查找的數(shù)據(jù)和自己定義的公式得到所得工資。4.3、按條件查找功能在文本框中輸入職工號(hào),點(diǎn)擊查找能找到對(duì)應(yīng)職工的工資情況,如圖4.4。用getText()textbooleanbool,記錄數(shù)據(jù)庫中是否有對(duì)應(yīng)的職工號(hào),假若查到則為true,并且在表格中先用removeAll()方式清空表的信息,然后用sqltext4.4、錄入功能輸入職工信息,點(diǎn)擊錄入修改數(shù)據(jù)庫的信息,getText()textDBHelperdbupdate4.5、刪除功能點(diǎn)擊選中行,然后點(diǎn)擊刪除按鈕就會(huì)將選種的行刪除掉,例如刪除圖4.3table.getSelection()方式查找并int[]table.getSelectionIndices()方式查找并存儲(chǔ)選中行的行號(hào),用這兩個(gè)信息分別刪除數(shù)據(jù)庫和界面的選中信息。4.6、注冊(cè)功能點(diǎn)擊注冊(cè)鍵后進(jìn)入如圖4.7user,passwordpasspasspassworddispose()方式關(guān)閉此窗口。4.7五、設(shè)計(jì)總結(jié)員變量就無法把數(shù)據(jù)傳遞出去,我們學(xué)會(huì)了封裝,將連接數(shù)據(jù)庫的方式封裝到DBHelper六、程序清單importimportimportimportimportimportimportimportimportimportimportpublicclassdengluextendsShell{booleanbool;privateTexttext_1;privateTexttext;publicstaticvoidmain(Stringargs[]){try{shell.open();shell.layout();while(!shell.isDisposed()){if(!display.readAndDispatch())display.sleep();}}catch(Exceptione){e.printStackTrace();}}publicdenglu(Displaydisplay,intstyle){super(display,style);createContents();}protectedvoidcreateContents()setText("登陸界面");setSize(622,439);finalLabellabel=newLabel(thisSWT.BORDER);,label.setText("賬號(hào):");label.setBounds(90,112,60,27);finalLabellabel_1=newLabel(thisSWT.BORDER);,label_1.setText("密碼:");label_1.setBounds(90,185,60,27);text=newText(this,SWT.BORDER);text.setBounds(208,112,125,27);text_1=newText(this,SWT.BORDER|SWT.PASSWORD);text_1.setBounds(208,185,125,27);finalButtonbutton=newButton(this,SWT.NONE);button.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(finalSelectionEvente){Stringuser=text.getText();Stringpassword=text_1.getText();DBHelperdb=newDBHelper();Stringsql="select密碼fromuser_Tablewhere賬號(hào)='"+user+"'";ResultSetrs=db.query(sql);try{while(rs.next()){Stringpass=rs.getString("密碼");if(password.equals(pass)){bool=true;}else{bool=false;}if(bool==true){
try{zhigonggongzishell=newzhigonggongzi(display,shell.open();shell.layout();while(!shell.isDisposed()){if(!display.readAndDispatch())display.sleep();}}catch(Exceptione2){e2.printStackTrace();}}}}catch(SQLExceptione1){//TODOAuto-generatedcatchblocke1.printStackTrace();}}});button.setText("登陸");button.setBounds(388,255,48,22);finalButtonbutton_1=newButton(thisSWT.NONE);,button_1.setText("注冊(cè)");button_1.setBounds(388,306,48,22);finalLabellabel_2=newLabel(thisSWT.BORDER);,label_2.setText("歡迎使用員工工資管理系統(tǒng)");label_2.setBounds(90,37,271,27);//}@OverrideprotectedvoidcheckSubclass(){//DisablethecheckthatpreventssubclassingofSWTcomponents}}importimportimportimportimportimportimportimportimportimportimportimportimportimportpublicclasszhigonggongziextendsShell{privateTexttext;privateTabletable;publicstaticvoidmain(Stringargs[]){try{zhigonggongzishell=newzhigonggongzi(display,SWT.SHELL_TRIM);shell.open();shell.layout();while(!shell.isDisposed()){if(!display.readAndDispatch())display.sleep();}}catch(Exceptione){e.printStackTrace();}}publiczhigonggongzi(Displaydisplay,intstyle){super(display,style);createContents();}protectedvoidcreateContents());setSize(697,458);table=newTable(this,SWT.FULL_SELECTION|SWT.BORDER);table.setLinesVisible(true);table.setHeaderVisible(true);table.setBounds(10,67,573,214);finalTableColumnnewColumnTableColumn=newTableColumn(table,SWT.NONE);newColumnTableColumn.setWidth(73);newColumnTableColumn.setText("職工號(hào)");finalTableColumnnewColumnTableColumn_1=newTableColumn(table,SWT.NONE);newColumnTableColumn_1.setWidth(76);newColumnTableColumn_1.setText("職工姓名");finalTableColumnnewColumnTableColumn_2=newTableColumn(table,SWT.NONE);newColumnTableColumn_2.setWidth(76);newColumnTableColumn_2.setText("根本工資");finalTableColumnnewColumnTableColumn_3=newTableColumn(table,SWT.NONE);newColumnTableColumn_3.setWidth(80);newColumnTableColumn_3.setText("職位提成");finalTableColumnnewColumnTableColumn_4=newTableColumn(table,SWT.NONE);newColumnTableColumn_4.setWidth(79);newColumnTableColumn_4.setText("遲到天數(shù)");finalTableColumnnewColumnTableColumn_5=newTableColumn(table,SWT.NONE);newColumnTableColumn_5.setWidth(83);newColumnTableColumn_5.setText("曠工天數(shù)");finalTableColumnnewColumnTableColumn_6=newTableColumn(table,SWT.NONE);newColumnTableColumn_6.setWidth(100);newColumnTableColumn_6.setText("所得工資");finalButtonbutton=newButton(this,SWT.NONE);button.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(finalSelectionEvente){try{shell.open();shell.layout();while(!shell.isDisposed()){if(!display.readAndDispatch())display.sleep();}}catch(Exceptione2){e2.printStackTrace();}});
}a();button.setText("錄入");button.setBounds(604,142,55,31);finalButtonbutton_1=newButton(this,SWT.NONE);button_1.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(finalSelectionEvente){TableItem[]item=table.getSelection();DBHelperdb=newDBHelper();for(inti=0;i<item.length;i++){Stringid=item[i].getText(0);Stringsql="deletefrom職工信息表where職工號(hào)='"+id+"'";db.update(sql);}});
}db.close();int[]a=table.getSelectionIndices();table.remove(a);button_1.setText("刪除");button_1.setBounds(604,196,55,31);finalButtonbutton_2=newButton(this,SWT.NONE);button_2.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(finalSelectionEvente){a();}});button_2.setText("查詢");button_2.setBounds(604,91,55,31);text=newText(thisSWT.BORDER);text.setBounds(209,314,89,31);finalLabellabel=newLabel(this,SWT.BORDER);,label.setText("按職工號(hào)查找:");label.setBounds(53,314,136,31);finalButtonbutton_3=newButton(this,SWT.NONE);button_3.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(finalSelectionEvente){table.removeAll();Stringid=text.getText();DBHelperdb=newDBHelper();Stringsql="select*from職工信息表";ResultSetrs=db.query(sql);booleanbool=true;if(bool){try{while(rs.next()){SWT.BORDER);
if(id.equals(rs.getString("職工號(hào)"))){bool=false;finalTableItemnewItemTableItem=newTableItem(table,newItemTableItem.setText(0,rs.getString("職工號(hào)"));newItemTableItem.setText(1,rs.getString("姓名"));newItemTableItem.setText(2,rs.getString("根本工資"));newItemTableItem.setText(3,rs.getString("職位提成"));newItemTableItem.setText(4,rs.getString("遲到天數(shù)"));));newItemTableItem.setText(5,rs.getString("曠工天數(shù)"));));doublemoney=money1+money2-day1*50-day2*100;if(money<0){money=0;}StringMoney=String.valueOf(money);newItemTableItem.setText(6,Money);}}}catch(SQLExceptione1){//TODOAuto-generatedcatchblocke1.printStackTrace();}}}});button_3.setText("查找");button_3.setBounds(347,312,73,33);finalLabellabel_1=newLabel(thisSWT.BORDER);,label_1.setText("職工工資管理系統(tǒng)");label_1.setBounds(189,24,177,31);//}publicvoida(){table.removeAll();DBHelperdb=newDBHelper();Stringsql="select*from職工信息表";ResultSetrs=db.query(sql);try{while(rs.next()){finalTableItemnewItemTableItem=newTableItem(table,SWT.BORDER);newItemTableItem.setText(0,rs.getString("職工號(hào)"));newItemTableItem.setText(1,rs.getString("姓名"));newItemTableItem.setText(2,rs.getString("根本工資"));newItemTableItem.setText(3,rs.getString("職位提成"));newItemTableItem.setText(4,rs.getString("遲到天數(shù)"));));newItemTableItem.setText(5,rs.getString("曠工天數(shù)"));));doublemoney=money1+money2-day1*50-day2*100;if(money<0){money=0;}StringMoney=String.valueOf(money);newItemTableItem.setText(6,Money);}}catch(SQLExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();}}@OverrideprotectedvoidcheckSubclass(){//DisablethecheckthatpreventssubclassingofSWTcomponents}}importimportimportimportimportimportimportimportimportpublicclassluruextendsShell{privateTexttext_5;privateTexttext_4;privateTexttext_3;privateTexttext_2;privateTexttext_1;privateTexttext;publicstaticvoidmain(Stringargs[]){try{shell.open();shell.layout();while(!shell.isDisposed()){if(!display.readAndDispatch())display.sleep();}}catch(Exceptione){e.printStackTrace();}}publicluru(Displaydisplay,intstyle){super(display,style);createContents();}protectedvoidcreateContents()setText("職工工資錄入界面");setSize(660,451);finalLabellabel=newLabel(this,SWT.BORDER);label.setText("職工號(hào):");label.setBounds(87,82,87,26);finalLabellabel_1=newLabel(thisSWT.BORDER);,label_1.setText("姓名:");label_1.setBounds(87,119,87,24);finalLabellabel_2=newLabel(thisSWT.BORDER);,label_2.setText("根本工資:");label_2.setBounds(87,149,87,24);finalLabellabel_3=newLabel(thisSWT.BORDER);,label_3.setText("職位提成:");label_3.setBounds(87,179,87,26);finalLabellabel_4=newLabel(thisSWT.BORDER);,label_4.setText("遲到天數(shù):");label_4.setBounds(87,219,87,26);finalLabellabel_5=newLabel(thisSWT.BORDER);,label_5.setText("曠工天數(shù):");label_5.setBounds(87,258,87,26);finalLabellabel_6=newLabel(thisSWT.BORDER);,label_6.setText("職工工資錄入界面");label_6.setBounds(209,25,177,35);text=newText(this,SWT.BORDER);text.setBounds(241,82,70,26);text_1=newText(this,SWT.BORDER);text_1.setBounds(241,119,70,24);text_2=newText(this,SWT.BORDER);text_2.setBounds(241,149,70,24);text_3=newText(this,SWT.BORDER);text_3.setBounds(241,179,70,26);text_4=newText(this,SWT.BORDER);text_4.setBounds(241,219,70,26);text_5=newText(this,SWT.BORDER);text_5.setBounds(241,260,70,26);finalButtonbutton=newButton(this,SWT.NONE);button.addSelectionListener(newSelectionAdapter(){publicvoidwidgetSelected(finalSelectionEvente){Strings1=text.getText();Strings2=text_1.getText();Strings3=text_2.getText();Strings4=text_3.getText();Strings5=text_4.getText();Strings6=text_5.getText();DBHelperdb=newDBHelper();Stringsql="insertinto曠工天數(shù))values('"+s1+"','"+s2+"','"+s3+"','"+s4+"','"+s5+"','"+s6+"')";db.update(sql);luru.this.dispose();}});button.setText("錄入");button.setBounds(430,321,48,22);//}@OverrideprotectedvoidcheckSubclass(){//DisablethecheckthatpreventssubclassingofSWTcomponents}importimportimportimportimportimportimportimportimportpublicclasszhuceextendsShell{privateTexttext_2;privateTexttext_1;privateTexttext;publicstaticvoidmain(Stringargs[]){try{shell.open();shell.layout();while(!shell.isDisposed()){if(!display.readAndDispatch())display.sleep();}}catch(Exceptione){e.printStackTrace();}}publiczhuce(Displaydisplay,intstyle){super(display,style);createContents();}protectedvoidcreateContents()setText("新用戶注冊(cè)界面");setSize(611,455);finalLabellabel=newLabel(thisSWT.BORDER);,label.setText("新用戶注冊(cè)界面");label.setBounds(161,49,163,22);finalLabellabel_1=newLabel(thisSWT.BORDER);,label_1.setText("賬號(hào):");label_1.setBounds(76,123,104,22)
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026浙江溫州市樂清市城衛(wèi)清潔服務(wù)有限公司長(zhǎng)期招聘考試備考題庫及答案解析
- 浙商銀行嘉興分行2026年一季度社會(huì)招聘筆試模擬試題及答案解析
- 2026陜西商洛柞水縣縣直部分空編單位選調(diào)(選聘)11人筆試參考題庫及答案解析
- 2026年新能源汽車維修技能提升課
- 2026年加油站員工應(yīng)急演練指南
- 2026內(nèi)蒙古通遼市扎魯特旗敦德諾爾露天煤業(yè)有限公司招聘12人筆試備考題庫及答案解析
- 2026年度安徽國(guó)際商務(wù)職業(yè)學(xué)院省直事業(yè)單位公開招聘工作人員19名筆試備考試題及答案解析
- 2026上半年貴州事業(yè)單位聯(lián)考省農(nóng)業(yè)科學(xué)院招聘18人筆試備考試題及答案解析
- 2026年房地產(chǎn)中介帶看流程優(yōu)化
- 2026年體育賽事組織管理培訓(xùn)
- 《養(yǎng)老機(jī)構(gòu)智慧運(yùn)營(yíng)與管理》全套教學(xué)課件
- 2025年本科院校圖書館招聘面試題
- 電子商務(wù)畢業(yè)論文5000
- 2025-2026學(xué)年人教版(2024)初中生物八年級(jí)上冊(cè)教學(xué)計(jì)劃及進(jìn)度表
- 醫(yī)療衛(wèi)生輿情課件模板
- 高壓注漿施工方案(3篇)
- 高強(qiáng)混凝土知識(shí)培訓(xùn)課件
- (高清版)DB11∕T 1455-2025 電動(dòng)汽車充電基礎(chǔ)設(shè)施規(guī)劃設(shè)計(jì)標(biāo)準(zhǔn)
- 暖通工程施工環(huán)保措施
- 宗族團(tuán)年活動(dòng)方案
- 2025至2030中國(guó)碳納米管行業(yè)市場(chǎng)發(fā)展分析及風(fēng)險(xiǎn)與對(duì)策報(bào)告
評(píng)論
0/150
提交評(píng)論