

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、i JAVA 程序设计 课程设计报告 设计题目: 运动会成绩管理系统 _ 学院名称:信息工程学院 专业班级: _ 姓 名: _ 学 号: 13122102391312210239 _ 2 oooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooooooooooooooo 需求分析。 概要设计。 详细设计。 目录 3.2.1 数据库模块设计 3.2.2 用户登录识别模块 3.2.3 主页面模块 。 3.2.4 运动员信息浏览模块 3.2.5 添加运动员信息模块 oooooooooooooooooooooooo
2、ooooooooooooooooo ooooooooooooooooooooooooooooooooooooooo ooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooooooooooo 3.2.6 运动员信息查询修改模块 3.2.7 运动员信息查删除模块 3.3 主要程序代码。 四 软件测试。 oooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooooooooooooo
3、oooooooo oooooooooooooooooooooooooooooooooooooooooooooooooooo 五 总结。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 。 参考资料: 8 15 23 24 一 需求分析 本系统的主要目的就是实现运动会成绩管理 ,使运动会成绩管理工作更加容易 作效率 ,降低管理成本 . ,从而提高工 3.1 数据库设计。 3.2 模块及窗体设计。 3 系统中需要对拥护身份进行管
4、理,采取登陆进入系统的形式 二 概要设计 /* 概要设计阶段主要是粗略描述整个软件的框架, 并从业务的角度描述软件的模块、 工作 流程等。 项目的成功取决于设计的好坏, 而概要设计则是整个设计的关键部分。 概要设计的 主要任务是将用户的需求划分为不同的功能, 然后将这些功能细分成模块, 并给模块一些规 则约束, 以达到各个模块之间可以相互交流的目的。 概要设计关乎到系统的整体架构, 因此 想做好一个概要设计,不仅仅要熟悉用户的业务流程,还要具备相当丰富的设计经验。 2.1 概要设计的原则 概要设计是根据系统分析的需求和工作环境的情况对整个软件的总体结构进行大致的 设计。概要设计要坚持以下几个原
5、则。 (1)细分原则:软件系统都是由很多不同的模块组成,当设计一套软件时,要先将所 有的功能分解。解决复杂问题的方法是将其分解成几个小问题,一个个来解决。 (2)提高代码重用性:在面向对象设计中,首先考虑的就是代码的重用,一个好的设 计,将来在升级换代时不需要太大的改动,节省了人力物力。 (3)从上而下层层分析:概要设计要从整体出发,逐个剖析软件的功能,从上而下, 先分析系统总的功能,然后一步步细分,直到最小的功能模块。 (4)一致性原则:概要设计要求所有功能模块在定义时使用统一的规范。 (5)提高独立性,减少耦合:各个模块与模块之间尽量减少关联,否则修改一个地方 就会引起其他多处的变动,不符
6、合面向对象的原则。一般情况下, 对类封装后,只允许对类 进行扩展, 而不能修改, 而封装的类必须具有单一职责, 既理论情况下不允许两个类共同完 成一个功能。 (6)模块的大小要尽量适中:不是结构算法越复杂的模块越好,模块的大小要根据实 际工作目标和其他类的耦合紧密程度来决定。 经验表明, 一个模块的规模不应过大, 模块的 总行数应控制在 10100 行的范围内,最好为 3060 行,这样理解和阅读都较方便。过长的 模块往往是分解不充分的表现, 会增加阅读理解的难度; 但小规模太多也会使模块之间联系 变得复杂,增大系统在模块调用时传递信息所花费的开销。 由于概要设计是整个设计的重中之重, 牵一发
7、而动全身, 所以要努力做一个好的概要设 计,才能在今后软件开发过程中不再反复。 现在软件行业流行模式化驱动设计, 将一些市场 上比较成功的模式拿来用在自己的设计中。 2.2 将用户需求模块化 根据概要设计的原则来分析一下本项目的用户需求, 并最终转化成用程序语言描述的模 块。什么样的需求才是一个模块?模块应该具备如下 3 个特征。 (1)输入和输出:模块必须能被调用并且正确的返回调用,而且调用都是相对一个对 象而言,这是模块独立性的一个体现。 (2)处理功能:模块必须可以对调用的输入数据进行灵活的处理,并为输出准备好处 理结果。 (3)程序代码:用来实现模块功能的源代码。 2.3 确定系统最终
8、模块 概要设计中最重要的就是确定此项目包括哪些模块。 根据上两节讲述的设计原则和模块 特征,将用户需求转化为下面的模块。4 *刘 2.4 UML 用例图 1.管理员权限 管理员 2.系统流程图 登陆 通过身悅 验応 自贝自贝 5 2.5 模块设计 1 数据库设计模块 2 用户登录识别模块 3 主页面模块 4 运动员信息浏览模块 5 运动员信息添加模块 6 运动员信息查询修改模块 7 运动员信息删除模块 三详细设计 3.1 数据库设计 数据库名称:yan gyu n 表名:table name 运动员信息表: 学号(INT 型) 姓名(varchar) 班级(varchar) 项目名(varch
9、ar) 成绩(varchar) 1312210101 杨旳 13 计本 100 米 11.2S 1312210102 马凯 13 金融 跳咼 2.6M 1312210103 马嘉岐 14 电子 50 米短跑 14S 1312210104 刘飞 12 英语 铅球 5M 1312210105 王青山 13 信管 跳远 2.2 米 1312210106 李连杰 14 网络 1*400 45S 1312210107 任宇错 13 计本 跳咼 2.8M 1312210108 乔欢 14 网络 跳远 3.2M 1312210109 李小龙 15 信管 4*400 男子接力 40S 1312210110 周
10、杰伦 13 音乐 跳远 3.5M 1312210111 周星星 14 表演 跳咼 2.9M 1312210112 王泽林 15 生物 铅球 6M 1312210113 刘德华 15 表演 跳远 3.4M 1312210114 赵一德 13 计本 跳远 3M 1312210115 周小华 14 英语 跳咼 2.5M 1312210116 王晶晶 15 生物 4*400 女子接力 50S 1312210117 刘华 15 信管 铅球 6.9M 6 1312210118 刘毅 14 英语 4*400 男子接力 43S 1312210119 王缓缓 14 网络 铅球 6.3M 7 3.2 模块及窗体设
11、计 3.2.1 数据库模块设计 将数据库的连接包装在一个 lianjie类中,以便其他模块能够轻松调用, 避 免 每次 重 写数 据库 连接代码。 F 表是他的基本属性 文件名 成员变量 成员方法 lianjie.java Conn ecti on conn PreparedStateme nt ps; Statement stmt ResultSet rs Public static int shanchu(String ) public static int xiugai(Stri ng) public static int zhucezh() 3.2.2 用户登录识别模块 代码圭寸装在类
12、De nlu,下表是他的基本属性 文件名 控件 成员方法 Deni u.java JLabel label 1= new JLabel(管理员登 录:); JLabel label2= new JLabel(管理员:); TextField n ame JLabel label3= new JLabel(密码:”); JPasswordField mima JButton butt on 1= new JButto n(登录); JButton butt on 2= new JButto n() public Denlu()() 3.2.3 主页面 8 以下是它的基本属性 文件名 控件名称 J
13、iemia n.java JButton butt on 1_0= new JButto n(运动员信息浏 览”); JButton butto n1_1= new JButto n(添加运动员信 息”); JButton butto n1_2= new JButto n(” 查询修改运动 员信息”); JButton butt on 1_3= new JButto n(” 删除运动员信 息”); JButton butt on 1 4= new JButto n(退出系统); 324 运动员信息浏览9 圄 _ 查看所有运动员信患 刷新刷新 返回主页返回主页 学号 姓名 班级 项目名 成绩 1
14、312210101 13计本 11.2S 1312210102 马凯 口金融 跳高 2 6M 1312210104 日專岐 W电子 別米短跑 143 1312210103 刘飞 花英语 铅球 5M 1312210105 王青山 伯信管 跳远 22米 1312210105 14网銘 1*400 45S 1312210107 任宝谐 口计本 跳高 2 8M 1312210103 界欢 4 4貉 3.2M 1312210109 李小龙 帖信管 4*400子接力 40S 1312210110 周杰伦 佗音乐 趾远 3.5M 1312210111 周星星 14夷演 KS- 2QM 1312210112
15、王泽林 佶生物 铅球 6M 1312210113 划律华 158 跳远 3.4M 1312210114 赵一徳 13计本 趾远 3M 1312250115 周小华 4磺语 跳高 2 5M 1312210115 王晶晶 “生柳 4制00女子接 503 1312210117 剤华 佰信菅 铅球 6.9M 1312210118 1锁语 4700男子接力 43S 1312210119 14网络 铅球 6.3M 基本属性如下 文件名 控件名 JTable table; Chaka nsuoyou.java JButton button4_0= new JButton(刷新”); JButton butt
16、on4 1= new JButton(返回主页); 325 添加运动员信息10 基本属性如下 文件名 控件名 Tianjia.java TextField num= new TextField(20); TextField n ame= new TextField(20); TextField banji= new TextField(20); TextField xia ngmu ming= new TextField(20); TextField che ngji= new TextField(20); Label Iabel1_o,label1_1,label1_2,label1_3,l
17、abel1_4,label1_5; JButton button1_0= new JButton(添加); JButton butt on 1 1= new JButto n(取消); 326 运动员信息的查询与修改 11 基本属性如下 文件名 控件名 Chagai.java TextField num= new TextField(20); TextField n ame= new TextField(20); TextField banji= new TextField(20); TextField xia ngmu ming= new TextField(20); TextField c
18、he ngji= new TextField(20); Label Iabel1_0,label1_1,label1_2,label1_3,label1_4,label1_5; JButton butt ton 1_0= new JButto n(修改); JButton butt on 1_1= new JButto n(取消); JButton butt ton 1 2= new JButto n(查询); 327 删除运动员信息 3.3 主要程序代码 1. 登陆主页: public classDenlu extends JFrame TextField n ame= new TextFi
19、eld(20); JPasswordField mima= new JPasswordField(15); JFrame f=new JFrame(榆林学院运动会成绩管理系统 ); public De nlu() f.setBou nds(450,200,400,300); f.setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE); f.setResizable( false); f.setLayout( null); JLabel label 仁 new JLabel(管理员登录:”); JLabel label2= new JLabel(管理员:”
20、); JLabel label3= new JLabel(密 码:); labell.setFont(new Font(Serif,Font. BOLD ,20); 12 labell.setBou nds(0,0,300,50); label2.setFont(new Font(Serif,Font. BOLD ,15); label3.setFont(new Font(Serif,Font. BOLD ,15); JButton butt on 1= new JButto n(登录); JButton button2= new JButton(取消); BHa ndler h= new B
21、Ha ndler(); butt on 1.addAct ion Liste ner(h); butt on 2.addAct ion Liste ner(h); JPa nel p1=new JPa nel(); JPa nel p2=new JPa nel(); JPanel p3=new JPa nel(); f.add(label1); p1.setBou nds(0,60,380,30); p1.add(label2); p1.add( name); p2.setBou nds(0,90,380,30); p2.add(label3); p2.add(mima); p3.setBou
22、 nds(0,150,420,40); p3.add(butto n1); p3.add(butto n2); f.add(p1); f.add(p2); f.add(p3); f.setVisible( true); public static void main(String args) Denlu a= new Denlu(); public classBHandler implements ActionListener public void actio nPerformed (Actio nEvent eve nt) if (even t.getActi on Comma nd()=
23、 登录) if(n ame.getText().equals(ya ngyu n)&mima.getTextf)quals(123) Jiemia n zhuce= new Jiemia n(); else JOptio nPan e.showMessageDialog (De nlu. this,卡号或者密码不正 确! ); else 13 f.dispose(); 2. 主界面: public classJiemian extends JFrame JFrame f=new JFrame(”运动会成绩管理系统界面 ”); public Jiemian() JLabel label1
24、; f.setBounds(400,150,600,450); f.setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE); f.setResizable(false) ; f.setLayout( null); labeI仁 new JLabel(欢迎进入榆林学院运动会成绩管理系统 ,SwingConstants.CENTER); label1.setFont(new Font(Serif,Font. BOLD,25); JButton button1_0= new JButton( 运动员信息浏览 ); JButton button1_1= new
25、JButton( 添加运动员信息 ); JButton button1_2= new JButton( 查询修改运动员信息 ); JButton button1_3= new JButton( 删除运动员信息 ); JButton button1_4= new JButton( 退 出 系 统); BHandler h= new BHandler(); button1_0.addActionListener(h); button1_0.setFont(new Font(宋体,Font. BOLD , 20); button1_0.setSize(400,35); button1_1.addAc
26、tionListener(h); butt on 1_1.setFo nt(new Fon t(宋体, Fon t. BOLD , 20); button1_1.setSize(400,35); button1_2.addActionListener(h); butt on 1_2.setFo nt(new Fon t(宋体, Fon t. BOLD , 20); button1_2.setSize(400,35); button1_3.addActionListener(h); button1_3.setFont(new Font(宋体, Font. BOLD , 20); button1_
27、3.setSize(400,35); button1_4.addActionListener(h); butt on 1_4.setFo nt(new Fon t(宋体,Fon t. BOLD , 20); button1_4.setSize(400,35); JPanel p0=new JPanel(); JPanel p1=new JPanel(); JPanel p2=new JPanel(); JPanel p3=new JPanel(); JPanel p4=new JPanel(); JPanel p5=new JPanel(); p0.setBounds(0,0,600,60);
28、 p0.add(label1); p1.setLayout( null); p1.setBounds(100,60,600,40); p1.add(button1_0); p2.setLayout( null); 14 p2.setBounds(100,120,600,40); p2.add(button1_1); p3.setLayout( null); p3.setBounds(100,180,600,40); p3.add(button1_2); p4.setLayout( null); p4.setBounds(100,240,600,40); p4.add(button1_3); p
29、5.setLayout( null); p5.setBounds(100,300,600,40); p5.add(button1_4); f.add(p0); f.add(p1); f.add(p2); f.add(p3); f.add(p4); f.add(p5); f.setVisible( true); private class BHandler implements ActionListener public void actionPerformed (ActionEvent event) if (event.getActionCommand()= 运动员信息浏览 ) Chakans
30、uoyou a=new Chakansuoyou(); elseif (event.getActionCommand()= 添加运动员信息 ) Tianjia b= new Tianjia(); elseif (event.getActionCommand()= 查询修改运动员信息 ) Chagai b= new Chagai(); elseif (event.getActionCommand()= 删除运动员信息 ) Shanchu b= new Shanchu(); elseif (event.getActionCommand()= 退 出 系 统) f.dispose(); 3. 运动员
31、信息浏览: public classChakansuoyou extends JFrame JFrame f=new JFrame(”查看所有运动员信息 ”); public static Object data=new Object305; JTable table; String lieming= 学 号,姓 名,班 级,项目名,成绩; public Chakansuoyou() f.setBounds(400,150,600,450); /f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 15 /f.setResizable(false)
32、; f.setLayout( null ); table=new JTable(data,lieming); table.setEnabled(false); / 表格不可编辑 JButton button4_0= new JButton(” 刷新); JButton button4j = new JButton(” 返回主页”); BHandler h= new BHandler(); button4_0.addActionListener(h); button4_1.addActionListener(h); JPanel p1=new JPanel(); JPanel p2=new JP
33、anel(); p1.setBounds(0,0,600,40); p1.add(button4_0); p1.add(button4_1); p2.setBounds(0,44,600,410); p2.add(new JScrollPane(table); f.add(p1); f.add(p2); f.setVisible( true ); private classBHandler implements ActionListener public void actionPerformed (ActionEvent event) if(event.getActionCommand()=
34、刷新 ) int h=0,l=0; /data=new Object305; try Class.forName(com.mysql.jdbc.Driver); Connection conn = DriverManager. getConnection(jdbc:mysql:/localhost:3306/yangyun,root,); Statement stmt=conn.createStatement(); ResultSet rs=stmt.executeQuery(select * from tablename); while(rs.next() System.out.printl
35、n(rs.getString(Uname); data hl+=rs.getString(ID); data hl+=rs.getString(Uname); data hl+=rs.getString(Ubanji); data hl+=rs.getString(Uxiangmuming); datahl+=rs.getString(Uchengji); h+;l=0; rs.close(); stmt.close(); conn.close(); table= new JTable(data,lieming); f.setVisible( true ); catch(Exception s
36、qle) 16 System.err .println(sqle); JOptionPane.showMessageDialog (Chakansuoyou.this, 系统故障,请稍后在试! ); else f.dispose(); 4 运动员信息添加: public classTianjia extends JFrame JFrame f=new JFrame(”添加运动员”); TextField num= new TextField(20); TextField name= new TextField(20); TextField banji= new TextField(20); T
37、extField xiangmuming= new TextField(20); TextField chengji= new TextField(20); public Tianjia() / 添加运动员 JLabel label1_0,label1_1,label1_2,label1_3,label1_4,label1_5; JPanel p1,p2,p3,p4,p1_0,p1_1,p1_2,p1_3,p1_4,p1_5,p1_6; f.setBounds(400,150,600,450); /f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
38、; f.setResizable(false); f.setLayout( null ); JButton button1_0= new JButton( 添加 ); JButton button1_1= new JButton( 取消 ); BHandler h= new BHandler(); button1_0.addActionListener(h); button1_1.addActionListener(h); label1_0= new JLabel(请输入要添加的运动员信息 ”,SwingConstants. CENTER); label1_0.setFont(new Font
39、(Serif,Font. BOLD ,25); label1_1 = new JLabel(学 号:”,SwingConstants. CENTER); label1_1.setFont(new Font(Serif,Font. BOLD ,15); label1_2= new JLabel(姓 名:”,SwingConstants. CENTER); label1_2.setFont(new Font(Serif,Font. BOLD ,15); Iabel1_3= new JLabel(班 级:”,SwingConstants. CENTER); label1_3.setFont(new
40、Font(Serif,Font. BOLD ,15); Iabel1_4= new JLabel(项目名:”,SwingConstants. CENTER); label1_4.setFont(new Font(Serif,Font. BOLD ,15); Iabel1_5= new JLabel(成 绩:”,SwingConstants. CENTER); label1_5.setFont(new Font(Serif,Font. BOLD ,15); p1_0=new JPanel(); p1_0.setBounds(0,0,400,80); 17 p1_0.add(label1_0);
41、p1_1=new JPanel(); p1_1.setBounds(0,80,550,50); p1_1.add(label1_1); p1_1.add(num); p1_2=new JPanel(); p1_2.setBounds(0,130,550,50); p1_2.add(label1_2); p1_2.add(name); p1_3=new JPanel(); p1_3.setBounds(0,180,550,50); /p1_3.setBackground(Color.blue); p1_3.add(label1_3); p1_3.add(banji); p1_4= new JPa
42、nel(); p1_4.setBounds(0,230,550,50); p1_4.add(label1_4); p1_4.add(xiangmuming); p1_5= new JPanel(); p1_5.setBounds(0,280,550,50); p1_5.add(label1_5); p1_5.add(chengji); p1_6= new JPanel(); p1_6.setBounds(0,330,600,50); p1_6.add(button1_0); p1_6.add(button1_1); f.add(p1_0); f.add(p1_1); f.add(p1_2);
43、f.add(p1_3); f.add(p1_4); f.add(p1_5); f.add(p1_6); f.setVisible( true ); private class BHandler implements ActionListener public void actionPerformed (ActionEvent event) if(event.getActionCommand()= 添加 ) int q; q=Lianjie. zhucezh(num.getText(),name.getText(),banji.getText(),xiangmuming.getText(),ch
44、engji. getText(); if(q=1) JOptionPane.showMessageDialog(Tianjia. this, 添加成功! ); else JOptionPane.showMessageDialog (Tianjia. this, 系统故障,请稍后在试! ); else f.dispose(); 5.运动员信息查询与修改: public classChagai extends JFrame JFrame f=new JFrame(”修改运动员信息”); TextField num= new TextField(20); TextField name= new Te
45、xtField(20); TextField banji= new TextField(20); TextField xiangmuming= new TextField(20); TextField chengji= new TextField(20); public Chagai() JLabel label1_0,label1_1,label1_2,label1_3,label1_4,label1_5; JPanel p1,p2,p3,p4,p1_0,p1_1,p1_2,p1_3,p1_4,p1_5,p1_6; 18 f.setBounds(400,150,600,450); /f.se
46、tDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setResizable(false); f.setLayout( null ); JButton butt on 1_0= new JButto n(” 修改); JButton butt on 1_1= new JButto n(” 取消); JButton butt on 1_2= new JButto n(” 查询); BHandler h= new BHandler(); button1_0.addActionListener(h); button1_1.addActionListener
47、(h); button1_2.addActionListener(h); label1_0= new JLabel(请输入要添加的运动员信息 ”,SwingConstants. CENTER); label1_0.setFont(new Font(Serif,Font. BOLD ,25); label1_仁 new JLabel(学 号:”,SwingConstants. CENTER); label1_1.setFont(new Font(Serif,Font. BOLD ,15); label1_2= new JLabel(姓 名:”,SwingConstants. CENTER); l
48、abel1_2.setFont(new Font(Serif,Font. BOLD ,15); Iabel1_3= new JLabel(班 级:”,SwingConstants. CENTER); label1_3.setFont(new Font(Serif,Font. BOLD ,15); Iabel1_4= new JLabel(项目名:”,SwingConstants. CENTER); label1_4.setFont(new Font(Serif,Font. BOLD ,15); Iabel1_5= new JLabel(成 绩:”,SwingConstants. CENTER)
49、; label1_5.setFont(new Font(Serif,Font. BOLD ,15); p1_0=new JPanel(); p1_0.setBounds(0,0,400,80); p1_0.add(label1_0); p1_1= new JPanel(); p1_1.setBounds(0,80,610,50); p1_1.add(label1_1); p1_1.add(num); p1_1.add(button1_2); p1_2= new JPanel(); p1_2.setBounds(0,130,550,50); p1_2.add(label1_2); p1_2.ad
50、d(name); p1_3= new JPanel(); p1_3.setBounds(0,180,550,50); /p1_3.setBackground(Color.blue); p1_3.add(label1_3); p1_3.add(banji); p1_4= new JPanel(); p1_4.setBounds(0,230,550,50); p1_4.add(label1_4); p1_4.add(xiangmuming); p1_5= new JPanel(); p1_5.setBounds(0,280,550,50); p1_5.add(label1_5); p1_5.add
51、(chengji); p1_6= new JPanel(); p1_6.setBounds(0,330,600,50); p1_6.add(button1_0); p1_6.add(button1_1); f.add(p1_0); f.add(p1_1); f.add(p1_2); f.add(p1_3); f.add(p1_4); f.add(p1_5); f.add(p1_6); f.setVisible( true ); 19 private class BHandler implements ActionListener public void actionPerformed (Act
52、ionEvent event) if (event.getActionCommand()= 查询 ) num.setEditable(false); try Class.forName (com.mysql.jdbc.Driver); Connection conn = DriverManager. getConnection(jdbc:mysql:/localhost:3306/yangyun,root,); Statement stmt=conn.createStatement(); ResultSet rs=stmt.executeQuery(select * from tablenam
53、e where ID=+num.getText()+); if(rs.next() name.setText(rs.getString(Uname); banji.setText(rs.getString(Ubanji); xiangmuming.setText(rs.getString(Uxiangmuming); chengji.setText(rs.getString(Uchengji); rs.close(); stmt.close(); conn.close(); else JOptio nPan e.showMessageDialog (Chagai. this,此运动员不存在!)
54、; catch(Exception sqle) System.err .println(sqle); JOptionPane.showMessageDialog (Chagai.this,系统故障,请 稍后在试! ); elseif (event.getActionCommand()= 修改 ) num.setEditable(true); int y=Lianjie. xiugai (num.getText(),name.getText(),banji.getText(),xiangmuming.getText(),chengji.ge tText(); if(y=1) JOptio nPa
55、 ne.showMessageDialog(Chagai. this,修改成功! ”); else JOptionPane.showMessageDialog (Chagai.this,系统故障,请稍后在 试! ); else f.dispose(); 20 6 运动员信息删除: public classShanchu extends JFrame JFrame f=new JFrame( 删除运动员 ); TextField num= new TextField(20); public Shanchu() / 删除运动员 JLabel label1_0,label1_1; JPanel p1
56、,p2,p3; f.setBounds(400,150,600,450); f.setResizable(false); f.setLayout( null ); JButton button1_0= new JButton( 删除 ); JButton button1_1= new JButton( 取消 ); BHandler h= new BHandler(); button1_0.addActionListener(h); button1_1.addActionListener(h); label1_0= new JLabel(请输入要删除的运动员信息 ”,SwingConstants
57、. CENTER); label1_0.setFont(new Font(Serif,Font. BOLD ,25); label1_1= new JLabel(学 号:”,SwingConstants. CENTER); label1_1.setFont(new Font(Serif,Font. BOLD ,15); p1=new JPanel(); p1.setBounds(0,0,400,80); p1.add(label1_0); p2=new JPanel(); p2.setBounds(0,80,550,50); p2.add(label1_1); p2.add(num); p3=
58、new JPanel(); p3.setBounds(0,160,600,50); p3.add(button1_0); p3.add(button1_1); f.add(p1); f.add(p2); f.add(p3); f.setVisible( true); private classBHandler implements ActionListener public void actionPerformed (ActionEvent event) if(event.getActionCommand()= 删除 ) int j=Lianjie. shanchu(num.getText()
59、; if(j=1) JOptionPane.showMessageDialog(Shanchu.this, 删除成功! ); elseif (j=3) JOptionPane.showMessageDialog (Shanchu.this, 系统故障, 请稍后在试! ); else JOptio nPan e.showMessageDialog (Sha nchu.this,此运动员不存在! ”); else f.dispose(); 7 连接数据库代码: public classLianjie public Lianjie() public static int shanchu(String
60、 id) 21 int a; try String driverClassName = com.mysql.jdbc.Driver; Class.forName(com.mysql.jdbc.Driver); Connection conn = DriverManager. getConnection(jdbc:mysql:/localhost:3306/yangyun,root,); PreparedStatement ps; Statement stmt=conn.createStatement(); ResultSet rs=stmt.executeQuery(select * from tab
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年项目部安全管理人员安全培训考试试题及参考答案一套
- 2024-2025新入职员工安全培训考试试题附完整答案【历年真题】
- 2025工厂职工安全培训考试试题带下载答案可打印
- 2025建筑电气工程分包合同
- 2025年华国某著名服装品牌省级销售总代理合同书(含附加协议)
- 2025财政资金借款合同范本
- 2025饮品加盟店合同
- 2025版商务办公租赁合同范本
- 2025健身房装修承包合同范本
- 2025木材采购合同范本
- 肺部感染的护理课件
- 2024年风力发电运维值班员(高级工)理论考试题库-下(判断题部分)
- 2022年信创产业发展基础知识
- 有余数的除法算式300题
- 2024年度医患沟通课件
- 2024年安徽六安市“政录企用”人才引进招聘笔试参考题库含答案解析
- CJJ82-2012 园林绿化工程施工及验收规范
- 水泵维保方案
- 2024年医药卫生考试-医院设备科笔试历年真题荟萃含答案
- 园林植物的识别与应用-草本花卉的识别与应用
- 感谢母爱主题班会(感恩主题班会)课件
评论
0/150
提交评论