第一范文网 - 专业文章范例文档资料分享平台

13401053聂三丽《Java程序设计》课程设计报告

来源:用户分享 时间:2025/6/1 9:57:25 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

Java程序设计课程设计

图3-4 查询界面图

5.背景图片模块,点击进入设置背景图片。

图3-5 设置背景图片界面图

6.点击,弹出帮助框。

图3-6 帮助界面图

3.2关键代码说明

主要功能代码:

表3-1主要功能代码表

序号 1 2 3 用户登录 开始测试 事件 控件 JMenuItem JButton JMenuItem 7

对象名 item1 restart Item2 备注 查询测试结果 Java程序设计课程设计

4 5 6 退出 帮助 设置背景 JMenuItem JMenuItem JMenuItem item3 item5 Item6 1. 点击,登录,进入另一个界面。

JMenuItem item1 = new JMenuItem(\用户登录\item1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) { setDefaultCloseOperation(EXIT_ON_CLOSE); new Login(\用户登录\进入另一个界面 dispose(); //主界面关闭 } });

2. 登录后,进入开始测试模块,进行测试,做题,输出精神状况测试结果。然后将测试结果存入文件。

restart = new JButton(\开始测试\按钮

restart.addActionListener(this);

next = new JButton(\下一题\按钮

next.addActionListener(this);

ButtonGroup btgroup = new ButtonGroup();//六个单选按钮放在一组

radioButton = new JCheckBox[6];//单选答案

String t[]={\for(int i=0;i<=5;i++){

radioButton[i]=new JCheckBox(t[i]); btgroup.add(radioButton[i]);

radioButton[i].addItemListener(this);

}

MyDialog(){

setVisible(true);

ok= new JButton(\保存分数\cancel = new JButton(\不保存\

8

Java程序设计课程设计

ok.addActionListener(this); cancel.addActionListener(this); setLayout(new FlowLayout()); add(ok);

add(cancel);

3.点击进入,查询心理测试结果。

JMenuItem item2 = new JMenuItem(\查询测试结果\ item2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) {

setDefaultCloseOperation(EXIT_ON_CLOSE);

dispose(); //主界面关闭 new Searsh(\测试结果\

} }); 4.点击,退出主菜单。

JMenuItem item3 = new JMenuItem(\退出\

item3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } });

5.点击,弹出帮助框。

JMenuItem item5 = new JMenuItem(\帮助\ item5.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) {

JOptionPane.showMessageDialog(null, \制作者:聂三丽2015.06.04 若有疑问请联系18164036457!\

} });

6.点击进入设置背景图片。

JMenuItem item6 = new JMenuItem(\背景设置\

9

制作时间: Java程序设计课程设计

item6.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) {

setDefaultCloseOperation(EXIT_ON_CLOSE); new ImageWin(\背景设置\ //进入另一个界面 dispose(); //主界面关闭 } });

4. 系统测试

1.如果试卷到最后了,则提示是否保存测试结果。

图4-1 保存界面提示图

2.如果没有试卷文件,则输出无试题文件。

图4-2 无试题界面提示图

3.系统中有些输入错误,则给出提示。

图4-3 输入错误界面提示图

10

13401053聂三丽《Java程序设计》课程设计报告.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c8r3w12oy6g4m0xc0pduz_3.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top