员工出勤管理系统 java图形化界面设计_第1页
员工出勤管理系统 java图形化界面设计_第2页
员工出勤管理系统 java图形化界面设计_第3页
员工出勤管理系统 java图形化界面设计_第4页
员工出勤管理系统 java图形化界面设计_第5页
已阅读5页,还剩37页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、装订线长 春 大 学 课程设计纸共42页 第42页目录设计目的2功能介绍2程序流程2设计步骤3设计总结7程序清单7一、设计目的通过课程设计,使自己提高理论联系实际解决实际问题的能力;也使自己对基于面向对象的理论进行系统设计过程中的诸多具体问题有感性的认识和深入的理解;进而提高自己的学习兴趣为其将来顺利进入毕业环节作必要的准备。按照教师给出的思路和计划进度安排独立完成课程设计二、功能介绍1、具有新用户注册功能。2、具有注册用户登录功能。3、具有员工信息的录入功能。4、具有员工出勤信息的录入功能。5、具有数据查询功能,可以实现查询全部信息和按条件执行查询。6、具有按条件删除数据功能。7、具有统计功

2、能8、.本程序采用RCP技术,和SQL数据库。三程序流程四、设计步骤(一)程序设计步骤1建立RCP工程并构建数据库2建立RCP工程需要的view和editor3构建基本框架,并主要修改Perspective和WorkbenchWindowAdvisor两个文件4构建需要的辅助文件5.测试(二)图片说明:1登录窗口和注册窗口2.菜单部分3.功能实现模块 查询所有人的出勤情况修改出勤情况增加新的员工信息删除不用的信息管理员密码修改(三)数据库设计员工出勤表管理员表五、设计总结经过将近一周的课程设计,对java有了更深一层次的认识,感觉java很强大。虽然系统的基本功能都已实现,但还是存在系统不稳定

3、等多个问题尚待解决。这个系统主要是我自己开发的,但也得到了老师和同学的很大帮助。我正在做系统的过程中遇到了很多问题,有的是知识存储不足,有的是考虑不够周全,之所以能够顺利实现基本功功能,离不开老师和同学的大力相助。事实证明,只靠自己是不能顺利完成一套功能完整的系统的,必须充分利用团队的力量。开发一套系统,最重要的是细心,并不是一定要做到面面俱到,但也要充分考虑到客户的需求和现实意义,不管什么系统,只用运用到实际应用中,才具有先现实意义。所以在准备工作中要正确分析社会需求了解现实应用,画出流程图,把大体框架做好,然后再逐一细化。我们不可能做到面面俱到,但一定要做到步步扎实,作为一个程序编程人员,

4、要保持清醒的头脑,以现实为依据,让自己的每一行代码都能实现自己的意义。 通过这次课程设计,我收获的不仅仅是课程上的知识得到实际应用,还有编程的基本习惯和开发系统时应注意的流程。虽然课程设计结束了,但是java的学习却没有结束,以后更加努力的。六.部分主要程序清单1.RCP中需要修改的ApplicationWorkbenchAdvisor文件importorg.eclipse.swt.SWT;importorg.eclipse.swt.widgets.Display;importorg.eclipse.ui.application.IWorkbenchWindowConfigurer;impor

5、torg.eclipse.ui.application.WorkbenchAdvisor;importorg.eclipse.ui.application.WorkbenchWindowAdvisor;importviews.Loginshell;publicclassApplicationWorkbenchAdvisorextendsWorkbenchAdvisor privatestaticfinal String PERSPECTIVE_ID = rsgl.perspective;publicstaticbooleantag = false;publicWorkbenchWindowAd

6、visorcreateWorkbenchWindowAdvisor(IWorkbenchWindowConfigurerconfigurer) try Display display = Display.getDefault();Loginshell shell = newLoginshell(display, SWT.SHELL_TRIM);shell.open();shell.layout();while (!shell.isDisposed() if (!display.readAndDispatch()display.sleep(); catch (Exception e) e.pri

7、ntStackTrace();if(tag)returnnewApplicationWorkbenchWindowAdvisor(configurer);elsereturnnull; public String getInitialWindowPerspectiveId() returnPERSPECTIVE_ID;2.RCP中需要修改的Perspective文件importorg.eclipse.ui.IPageLayout;importorg.eclipse.ui.IPerspectiveFactory;importviews.Menus;importviews.MyInfo;publi

8、c class Perspective implements IPerspectiveFactory public void createInitialLayout(IPageLayout layout) layout.addView(Menus.ID, IPageLayout.LEFT, 0.45f, layout.getEditorArea();layout.addView(MyInfo.ID, IPageLayout.BOTTOM, 0.6f, Menus.ID);3.功能部分程序3.1用户注册public class LoginShell extends Shell private T

9、ext text_2;private Text text_1;private Text text;public static void main(String args) try Display display = Display.getDefault();LoginShell shell = new LoginShell(display, SWT.SHELL_TRIM);shell.open();shell.layout();while (!shell.isDisposed() if (!display.readAndDispatch()display.sleep(); catch (Exc

10、eption e) e.printStackTrace();publicLoginShell(Display display, int style) super(display, style);createContents();setBackgroundImage(ResourceManager.getPluginImage(Activator.getDefault(), image/4ddf962769045c6b8b82a188.jpg);setBackground(SWTResourceManager.getColor(255, 255, 255);setImage(ResourceMa

11、nager.getPluginImage(Activator.getDefault(), image/4ddf962769045c6b8b82a188.jpg);setBackgroundMode(SWT.INHERIT_DEFAULT);setText(用户登陆);protected void createContents() setSize(507, 400);final Label label = new Label(this, SWT.NONE);label.setBackground(SWTResourceManager.getColor(255, 255, 255);label.s

12、etText(登录名:);label.setBounds(148, 195, 47, 17);text = new Text(this, SWT.BORDER);text.setBounds(220, 192, 116, 20);final Label label1 = new Label(this, SWT.NONE);label1.setBackground(SWTResourceManager.getColor(255, 255, 255);label1.setText(密码:);label1.setBounds(148, 235, 39, 17);text_1 = new Text(t

13、his, SWT.BORDER | SWT.PASSWORD);final Label label4 = new Label(this, SWT.NONE);text_1.addMouseListener(new MouseAdapter() public void mouseDown(final MouseEvent e) label4.setBackground(SWTResourceManager.getColor(255, 255, 255);if(text.getText().trim() != )label4.setImage(ResourceManager.getPluginIm

14、age(Activator.getDefault(), image/4.PNG);elselabel4.setImage(ResourceManager.getPluginImage(Activator.getDefault(), image/3.PNG);label4.setBounds(342, 195, 23, 17););text_1.setBounds(220, 232, 116, 20);final Label label2 = new Label(this, SWT.NONE);label2.setBackground(SWTResourceManager.getColor(25

15、5, 255, 255);label2.setText(验证码:);label2.setBounds(148, 274, 47, 17);text_2 = new Text(this, SWT.BORDER);final Label label3 = new Label(this, SWT.NONE);label3.setForeground(SWTResourceManager.getColor(255, 0, 0);label3.setFont(SWTResourceManager.getFont(方正舒体, 18, SWT.BOLD, true,false);final Label la

16、bel4_1 = new Label(this, SWT.NONE);text_2.addMouseListener(new MouseAdapter() public void mouseDown(final MouseEvent e) String a2 = 0, 1, 2, 3, 4, 5, 6, 7, 8,9, a, b, c, d, e, f, g, h, i, j,k, l, m, n, o, p, q, r, s, t, u,v, w, x, y, z ;Random r = new Random();String result = ;while (result.length()

17、 0)MessageDialog.openInformation(Shell, 恭喜你, 注册成功);elseMessageDialog.openError(Shell, 很遗憾, 注册失败!);db.close(););button_2.setBackground(SWTResourceManager.getColor(255, 255, 255);button_2.setText(提交);button_2.setBounds(501, 279, 104, 23);public void init(IEditorSite site, IEditorInput input)throwsPart

18、InitException setSite(site);setInput(input);OverridepublicbooleanisDirty() return false;OverridepublicbooleanisSaveAsAllowed() return false;3.3增加信息public class Addzg extends EditorPart public static final String ID = editors.Addzg; /$NON-NLS-1$private Text text2;private Text text1;private Text text3

19、;protected static final Shell Shell = null;public void createPartControl(Composite parent) System.currentTimeMillis();Composite container = new Composite(parent, SWT.NONE);container.setBackgroundImage(ResourceManager.getPluginImage(Activator.getDefault(), image/4ddf962769045c6b8b82a188.jpg);containe

20、r.setBackground(SWTResourceManager.getColor(255, 255, 255);final Label label = new Label(container, SWT.WRAP);label.setBackground(SWTResourceManager.getColor(255, 255, 255);label.setText(姓名:);label.setBounds(350, 153, 64, 17);final Label label1 = new Label(container, SWT.WRAP);label1.setBackground(S

21、WTResourceManager.getColor(255, 255, 255);label1.setText(性别:);label1.setBounds(350, 190, 64, 17);final Label label2 = new Label(container, SWT.NONE);label2.setBackground(SWTResourceManager.getColor(255, 255, 255);label2.setText(部门:);label2.setBounds(350, 230, 50, 17);final Label label3 = new Label(c

22、ontainer, SWT.NONE);label3.setBackground(SWTResourceManager.getColor(255, 255, 255);label3.setText(手机:);label3.setBounds(350, 270, 50, 17);text1 = new Text(container, SWT.BORDER);text1.setBounds(450, 150, 155, 23);final Button button = new Button(container, SWT.RADIO);button.setBackground(SWTResourc

23、eManager.getColor(255, 255, 255);button.addMouseListener(new MouseAdapter() public void mouseDown(final MouseEvent e) if(text1.getText().trim()=)MessageDialog.openError(Shell, 提示!, 姓名不能为空!););button.setText(男);button.setBounds(450, 190, 33, 17);final Button button_1 = new Button(container, SWT.RADIO

24、);button_1.setBackground(SWTResourceManager.getColor(255, 255, 255);button_1.addMouseListener(new MouseAdapter() public void mouseDown(final MouseEvent e) if(text1.getText().trim()=)MessageDialog.openWarning(Shell, 提示!, 姓名不能为空!););button_1.setBounds(572, 190, 33, 17);button_1.setText(女);text2 = new

25、Text(container, SWT.BORDER);text2.addMouseListener(new MouseAdapter() public void mouseDown(final MouseEvent e) if(!(button.getSelection()&!(button_1.getSelection()MessageDialog.openWarning(Shell, 提示!, 请选择性别!););text2.setBounds(450, 227, 155, 23);text3 = new Text(container, SWT.BORDER);text3.addMous

26、eListener(new MouseAdapter() public void mouseDown(final MouseEvent e) if(text2.getText().trim()=)MessageDialog.openWarning(Shell, 提示!, 部门信息不能为空!););text3.setBounds(450, 267, 155, 23);final Button button_2 = new Button(container, SWT.NONE);button_2.addMouseMoveListener(new MouseMoveListener() public

27、 void mouseMove(final MouseEvent arg0) if(text3.getText().trim()=)MessageDialog.openWarning(Shell, 警告!, 手机号不能为空!););button_2.addSelectionListener(new SelectionAdapter() public void widgetSelected(final SelectionEvent e) String sex1=;if(button.getSelection()sex1=button.getText();else if(button_1.getS

28、election()sex1=button_1.getText();intchushi=0;DBHelperdb = new DBHelper();String sql=insert into atten(name,sex,bumen,phone,absence,bleave,nbleave,travel,late) +values(+text1.getText()+,+sex1+,+text2.getText()+,+text3.getText()+,+chushi+,+chushi+,+chushi+,+chushi+,+chushi+);System.out.println(sql);i

29、nt m=db.update(sql);if(m0)MessageDialog.openInformation(Shell, 恭喜你, 注册成功);elseMessageDialog.openError(Shell, 很遗憾, 注册失败!);db.close(););button_2.setBackground(SWTResourceManager.getColor(255, 255, 255);button_2.setText(提交);button_2.setBounds(501, 300, 104, 23);public void init(IEditorSite site, IEdito

30、rInput input)throwsPartInitException setSite(site);setInput(input);publicbooleanisDirty() return false;publicbooleanisSaveAsAllowed() return false;3.5删除信息public class Delzg extends EditorPart public static final String ID = editors.Delzg; /$NON-NLS-1$private Text text_1;private Text text;protected s

31、tatic final Shell Shell = null;public void createPartControl(Composite parent) System.currentTimeMillis();Composite container = new Composite(parent, SWT.NONE);container.setBackgroundImage(ResourceManager.getPluginImage(Activator.getDefault(), image/4ddf962769045c6b8b82a188.jpg);container.setBackgro

32、und(SWTResourceManager.getColor(255, 255, 255);final Table table = new Table(container, SWT.BORDER);table.setLinesVisible(true);table.setHeaderVisible(true);table.setBounds(252, 223, 640, 115);finalTableColumn newColumnTableColumn_6 = new TableColumn(table, SWT.NONE);newColumnTableColumn_6.setWidth(

33、74);newColumnTableColumn_6.setText(职工编号);finalTableColumnnewColumnTableColumn = new TableColumn(table, SWT.NONE);newColumnTableColumn.setAlignment(SWT.CENTER);newColumnTableColumn.setWidth(86);newColumnTableColumn.setText(职工姓名);finalTableColumn newColumnTableColumn_1 = new TableColumn(table, SWT.NON

34、E);newColumnTableColumn_1.setAlignment(SWT.CENTER);newColumnTableColumn_1.setWidth(79);newColumnTableColumn_1.setText(所在部门);finalTableColumn newColumnTableColumn_2 = new TableColumn(table, SWT.NONE);newColumnTableColumn_2.setAlignment(SWT.CENTER);newColumnTableColumn_2.setWidth(110);newColumnTableCo

35、lumn_2.setText(性别);finalTableColumn newColumnTableColumn_8 = new TableColumn(table, SWT.NONE);newColumnTableColumn_8.setWidth(100);newColumnTableColumn_8.setText(缺勤次数);finalTableColumn newColumnTableColumn_3 = new TableColumn(table, SWT.NONE);newColumnTableColumn_3.setAlignment(SWT.CENTER);newColumn

36、TableColumn_3.setWidth(106);newColumnTableColumn_3.setText(请假次数);finalTableColumn newColumnTableColumn_9 = new TableColumn(table, SWT.NONE);newColumnTableColumn_9.setAlignment(SWT.CENTER);newColumnTableColumn_9.setWidth(106);newColumnTableColumn_9.setText(未请假次数);finalTableColumn newColumnTableColumn

37、_4 = new TableColumn(table, SWT.NONE);newColumnTableColumn_4.setAlignment(SWT.CENTER);newColumnTableColumn_4.setWidth(82);newColumnTableColumn_4.setText(出差次数);finalTableColumn newColumnTableColumn_5 = new TableColumn(table, SWT.NONE);newColumnTableColumn_5.setAlignment(SWT.CENTER);newColumnTableColu

38、mn_5.setWidth(82);newColumnTableColumn_5.setText(迟到次数);finalTableColumn newColumnTableColumn_7 = new TableColumn(table, SWT.NONE);newColumnTableColumn_7.setAlignment(SWT.CENTER);newColumnTableColumn_7.setWidth(82);newColumnTableColumn_7.setText(联系方式);text = new Text(container, SWT.BORDER);text.setBo

39、unds(681, 191, 135, 27);final Button button = new Button(container, SWT.NONE);button.addSelectionListener(new SelectionAdapter() public void widgetSelected(final SelectionEvent e) table.removeAll();String name=text.getText();String sql = select * from atten where name =+name+;DBHelperdb = new DBHelp

40、er();ResultSetrs = db.query(sql);int m=0;try while(rs.next()TableItemtableitem = new TableItem(table,SWT.NONE);tableitem.setText(new Stringrs.getString(id),rs.getString(name),rs.getString(bumen),rs.getString(sex),rs.getString(absence),rs.getString(bleave),rs.getString(nbleave),rs.getString(travel),r

41、s.getString(travel),rs.getString(late),rs.getString(phone);m+;if(m=0)MessageDialog.openError(Shell, 提示!, 没有你要找的信息!); catch (SQLException e1) e1.printStackTrace();db.close(););button.setImage(ResourceManager.getPluginImage(Activator.getDefault(), image/search.ico);button.setText(查找);button.setBounds(

42、832, 189, 60, 27);final Label label_1 = new Label(container, SWT.NONE);label_1.setText(姓名:);label_1.setBounds(616, 194, 31, 17);text_1 = new Text(container, SWT.BORDER);text_1.setBounds(484, 393, 108, 25);final Label label_2 = new Label(container, SWT.NONE);label_2.setBackground(SWTResourceManager.g

43、etColor(255, 255, 255);label_2.setAlignment(SWT.CENTER);label_2.setText(选择职工编号并注销);label_2.setBounds(498, 350, 204, 17);final Button button_1 = new Button(container, SWT.NONE);button_1.setImage(ResourceManager.getPluginImage(Activator.getDefault(), image/43.png);button_1.addSelectionListener(new Sel

44、ectionAdapter() public void widgetSelected(final SelectionEvent e) String sign=text_1.getText();String sql = delete staff where sid =+sign;DBHelperdb = new DBHelper();int m=db.update(sql);db.close();if(m!=0)MessageDialog.openInformation(Shell, 恭喜你, 注销成功);elseMessageDialog.openError(Shell, 很遗憾, 注销失败!

45、);table.removeAll();text.setText();text_1.setText();String sql2 = select * from atten;DBHelper db2 = new DBHelper();ResultSet rs2 = db2.query(sql2);try while(rs2.next()TableItemtableitem = new TableItem(table,SWT.NONE);tableitem.setText(new Stringrs2.getString(id),rs2.getString(name),rs2.getString(b

46、umen),rs2.getString(sex),rs2.getString(absence),rs2.getString(bleave),rs2.getString(nbleave),rs2.getString(travel),rs2.getString(travel),rs2.getString(late),rs2.getString(phone); catch (SQLException e1) e1.printStackTrace();db2.close(););button_1.setText(注销);button_1.setBounds(638, 391, 74, 27);publ

47、ic void setFocus() / Set the focuspublic void doSave(IProgressMonitor monitor) / Do the Save operationpublic void doSaveAs() / Do the Save As operationpublic void init(IEditorSite site, IEditorInput input)throwsPartInitException setSite(site);setInput(input);publicbooleanisDirty() return false;Overr

48、idepublicbooleanisSaveAsAllowed() return false;3.6修改出勤情况public void createPartControl(Composite parent) System.currentTimeMillis();Composite container = new Composite(parent, SWT.NONE);container.setBackgroundImage(ResourceManager.getPluginImage(Activator.getDefault(), image/4ddf962769045c6b8b82a188.

49、jpg);container.setBackground(SWTResourceManager.getColor(255, 255, 255);final Table table = new Table(container, SWT.BORDER);table.setLinesVisible(true);table.setHeaderVisible(true);table.setBounds(208, 205, 677, 164);finalTableColumn newColumnTableColumn_6 = new TableColumn(table, SWT.NONE);newColu

50、mnTableColumn_6.setWidth(74);newColumnTableColumn_6.setText(职工编号);finalTableColumnnewColumnTableColumn = new TableColumn(table, SWT.NONE);newColumnTableColumn.setAlignment(SWT.CENTER);newColumnTableColumn.setWidth(86);newColumnTableColumn.setText(职工姓名);finalTableColumn newColumnTableColumn_1 = new T

51、ableColumn(table, SWT.NONE);newColumnTableColumn_1.setAlignment(SWT.CENTER);newColumnTableColumn_1.setWidth(79);newColumnTableColumn_1.setText(所在部门);finalTableColumn newColumnTableColumn_2 = new TableColumn(table, SWT.NONE);newColumnTableColumn_2.setAlignment(SWT.CENTER);newColumnTableColumn_2.setWi

52、dth(110);newColumnTableColumn_2.setText(性别);finalTableColumn newColumnTableColumn_8 = new TableColumn(table, SWT.NONE);newColumnTableColumn_8.setWidth(100);newColumnTableColumn_8.setText(缺勤次数);finalTableColumn newColumnTableColumn_3 = new TableColumn(table, SWT.NONE);newColumnTableColumn_3.setAlignm

53、ent(SWT.CENTER);newColumnTableColumn_3.setWidth(106);newColumnTableColumn_3.setText(请假次数);finalTableColumn newColumnTableColumn_9 = new TableColumn(table, SWT.NONE);newColumnTableColumn_9.setAlignment(SWT.CENTER);newColumnTableColumn_9.setWidth(106);newColumnTableColumn_9.setText(未请假次数);finalTableCo

54、lumn newColumnTableColumn_4 = new TableColumn(table, SWT.NONE);newColumnTableColumn_4.setAlignment(SWT.CENTER);newColumnTableColumn_4.setWidth(118);newColumnTableColumn_4.setText(出差次数);finalTableColumn newColumnTableColumn_5 = new TableColumn(table, SWT.NONE);newColumnTableColumn_5.setAlignment(SWT.

55、CENTER);newColumnTableColumn_5.setWidth(82);newColumnTableColumn_5.setText(迟到次数);finalTableColumn newColumnTableColumn_7 = new TableColumn(table, SWT.NONE);newColumnTableColumn_7.setAlignment(SWT.CENTER);newColumnTableColumn_7.setWidth(82);newColumnTableColumn_7.setText(联系方式);text = new Text(contain

56、er, SWT.BORDER);text.setBounds(666, 173, 135, 27);final Button button = new Button(container, SWT.NONE);button.addSelectionListener(new SelectionAdapter() public void widgetSelected(final SelectionEvent e) table.removeAll();String name=text.getText();String sql = select * from atten where name =+nam

57、e+;DBHelperdb = new DBHelper();ResultSetrs = db.query(sql);int m=0;try while(rs.next()TableItemtableitem = new TableItem(table,SWT.NONE);tableitem.setText(new Stringrs.getString(id),rs.getString(name),rs.getString(bumen),rs.getString(sex),rs.getString(absence),rs.getString(bleave),rs.getString(nblea

58、ve),rs.getString(travel),rs.getString(late),rs.getString(phone);m+;if(m=0)MessageDialog.openError(Shell, 提示!, 没有你要找的信息!); catch (SQLException e1) e1.printStackTrace();db.close(););button.setImage(ResourceManager.getPluginImage(Activator.getDefault(), image/search.ico);button.setText(查找);button.setBo

59、unds(825, 171, 60, 27);final Label label_1 = new Label(container, SWT.NONE);label_1.setBackground(SWTResourceManager.getColor(255, 255, 255);label_1.setText(姓名:);label_1.setBounds(611, 176, 31, 17);text1 = new Text(container, SWT.BORDER);text1.setBounds(310, 387, 188, 25);final Label label_2 = new L

60、abel(container, SWT.NONE);label_2.setBackground(SWTResourceManager.getColor(255, 255, 255);label_2.setText(选择编号:);label_2.setBounds(207, 390, 60, 17);text2 = new Text(container, SWT.BORDER);text2.addMouseListener(new MouseAdapter() public void mouseDown(final MouseEvent e) if(text1.getText().trim().

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论