java 图形化用户界面课程_java图形化界面设计课程设计-员工出勤管理系统

《java图形化界面设计课程设计-员工出勤管理系统》由会员分享,可在线阅读,更多相关《java图形化界面设计课程设计-员工出勤管理系统(25页珍藏版)》请在人人文库网上搜索。

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

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

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

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

5、rg.eclipse.ui.application.WorkbenchAdvisor;import org.eclipse.ui.application.WorkbenchWindowAdvisor;import views.Loginshell;public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor private static final String PERSPECTIVE_ID = rsgl.perspective;public static boolean tag = false;public Workben。

6、chWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) 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 (Excep。

7、tion e) e.printStackTrace();if(tag)return new ApplicationWorkbenchWindowAdvisor(configurer);elsereturn null;public String getInitialWindowPerspectiveId() return PERSPECTIVE_ID;2.RCP中需要修改的Perspective文件import org.eclipse.ui.IPageLayout;import org.eclipse.ui.IPerspectiveFactory;import views.Menus;impor。

8、t views.MyInfo;public 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 ext。

9、ends Shell private Text 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。

10、.sleep(); catch (Exception e) e.printStackTrace();public LoginShell(Display display, int style) super(display, style);createContents();setBackgroundImage(ResourceManager.getPluginImage(Activator.getDefault(), image/4ddfc6b8b82a188.jpg);setBackground(SWTResourceManager.getColor(255, 255, 255);setImag。

11、e(ResourceManager.getPluginImage(Activator.getDefault(), image/4ddfc6b8b82a188.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);labe。

12、l.setText(登录名:);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 Tex。

13、t(this, 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.getPlugi。

14、nImage(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。

15、(255, 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。

16、 label4_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.lengt。

17、h() 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)throws 。

18、PartInitException setSite(site);setInput(input);Overridepublic boolean isDirty() return false;Overridepublic boolean isSaveAsAllowed() 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 Te。

19、xt text3;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/4ddfc6b8b82a188.jpg);container。

20、.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(SW。

21、TResourceManager.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(co。

22、ntainer, 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(SWTResource。

23、Manager.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 T。

25、ext(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.addMouse。

26、Listener(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.getSe。

28、lection()sex1=button_1.getText();int chushi=0;DBHelper db = 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);。

29、int 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, IEdit。

30、orInput input)throws PartInitException setSite(site);setInput(input);public boolean isDirty() return false;public boolean isSaveAsAllowed() 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;prote。

31、cted 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/4ddfc6b8b82a188.jpg);container.setBackground。

32、(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);final TableColumn newColumnTableColumn_6 = new TableColumn(table, SWT.NONE);newColumnTableColumn_6.setWidth(74。

33、);newColumnTableColumn_6.setText(职工编号);final TableColumn newColumnTableColumn = new TableColumn(table, SWT.NONE);newColumnTableColumn.setAlignment(SWT.CENTER);newColumnTableColumn.setWidth(86);newColumnTableColumn.setText(职工姓名);final TableColumn newColumnTableColumn_1 = new TableColumn(table, SWT.NO。

34、NE);newColumnTableColumn_1.setAlignment(SWT.CENTER);newColumnTableColumn_1.setWidth(79);newColumnTableColumn_1.setText(所在部门);final TableColumn newColumnTableColumn_2 = new TableColumn(table, SWT.NONE);newColumnTableColumn_2.setAlignment(SWT.CENTER);newColumnTableColumn_2.setWidth(110);newColumnTable。

35、Column_2.setText(性别);final TableColumn newColumnTableColumn_8 = new TableColumn(table, SWT.NONE);newColumnTableColumn_8.setWidth(100);newColumnTableColumn_8.setText(缺勤次数);final TableColumn newColumnTableColumn_3 = new TableColumn(table, SWT.NONE);newColumnTableColumn_3.setAlignment(SWT.CENTER);newCo。

36、lumnTableColumn_3.setWidth(106);newColumnTableColumn_3.setText(请假次数);final TableColumn newColumnTableColumn_9 = new TableColumn(table, SWT.NONE);newColumnTableColumn_9.setAlignment(SWT.CENTER);newColumnTableColumn_9.setWidth(106);newColumnTableColumn_9.setText(未请假次数);final TableColumn newColumnTable。

37、Column_4 = new TableColumn(table, SWT.NONE);newColumnTableColumn_4.setAlignment(SWT.CENTER);newColumnTableColumn_4.setWidth(82);newColumnTableColumn_4.setText(出差次数);final TableColumn newColumnTableColumn_5 = new TableColumn(table, SWT.NONE);newColumnTableColumn_5.setAlignment(SWT.CENTER);newColumnTa。

38、bleColumn_5.setWidth(82);newColumnTableColumn_5.setText(迟到次数);final TableColumn 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);te。

39、xt.setBounds(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+;DBHelper db = n。

40、ew DBHelper();ResultSet rs = db.query(sql);int m=0;try while(rs.next()TableItem tableitem = 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),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/searc。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值