当前位置:首页>> >>


吃豆豆游戏.rar

收藏

资源目录
    文档预览:
    编号:20181030003752120    类型:共享资源    大小:1.14MB    格式:RAR    上传时间:2018-10-30
    尺寸:148x200像素    分辨率:72dpi   颜色:RGB    工具:   
    35
    金币
    关 键 词:
    豆豆 游戏
    资源描述:
    JISHOU UNIVERSITY程 序 设 计 基 础课 程 设 计题 目: 吃豆子游戏作 者: 刘家兴学 号: 20154206203所属学院: 软件学院专业年级: 软件工程 2015 级 4 班指导教师: 宋旭东完成时间: 2016 年 6 月 2 日—2016 年 6 月 12 日软件学院制项目描述目的: 吃豆人是电子游戏历史上的经典街机游戏,可供大家在繁重工作之余,缓解压力,放松心情项目功能目标系统创新点:可实现游戏暂停功能,怪物的随机移动,吃金币,撞墙将位置不变连接数据库可登陆注册和修改密码系统主要流程登录 修改密码 注册游戏主界 面游戏规则游戏失败开始游戏退出游戏代码:package 我要吃豆子;import java.awt.Color;import java.awt.EventQueue;import java.awt.Font;import javax.swing.*;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import java.sql.*;public class Forget {// 注册private JFrame frame;private JTextField textField;private JTextField textField_2;private JPasswordField textField_3 = new JPasswordField();// 密码文不可见private JButton btnNewButton;static Statement stmt ;public ImageIcon img = new ImageIcon(“denglu.jpg“);// 背景图/*public static void main(String[] args) {new Forget();}*/public Forget() {chushihua();}private void chushihua() {// 初始化界面frame = new JFrame(“忘记密码“);frame.setBounds(500, 200, 350, 300);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.getContentPane().setLayout(null);// 默认布局JLabel lblNewLabel = new JLabel(“姓名:“);lblNewLabel.setBounds(50, 30, 90, 40);lblNewLabel.setFont(new java.awt.Font(“隶书“, 0, 30));lblNewLabel.setForeground(Color.BLUE);frame.getContentPane().add(lblNewLabel);JLabel lblNewLabel_2 = new JLabel(“账号:“);lblNewLabel_2.setBounds(50, 80, 90, 40);lblNewLabel_2.setFont(new java.awt.Font(“隶书 “, 0, 30));lblNewLabel_2.setForeground(Color.BLUE);frame.getContentPane().add(lblNewLabel_2);JLabel lblNewLabel_3 = new JLabel(“新密码:“);lblNewLabel_3.setBounds(20, 130, 120, 40);lblNewLabel_3.setFont(new java.awt.Font(“隶书 “, 0, 30));lblNewLabel_3.setForeground(Color.BLUE);frame.getContentPane().add(lblNewLabel_3);textField = new JTextField();textField.setBounds(150, 38, 150, 30);frame.getContentPane().add(textField);textField.setColumns(10);textField_2 = new JTextField();textField_2.setBounds(150, 88, 150, 30);frame.getContentPane().add(textField_2);textField_2.setColumns(10);textField_3.setBounds(150, 138, 150, 30);frame.getContentPane().add(textField_3);textField_3.setColumns(10);btnNewButton = new JButton(“返回“);btnNewButton.addMouseListener(new MouseAdapter() {@Overridepublic void mouseClicked(MouseEvent arg0) {frame.setVisible(false);new Login();}});btnNewButton.setFont(new Font(“隶书“, Font.PLAIN, 20));btnNewButton.setBounds(50, 190, 100, 30);btnNewButton.setForeground(Color.DARK_GRAY);frame.getContentPane().add(btnNewButton);btnNewButton = new JButton(“确认“);btnNewButton.addMouseListener(new MouseAdapter() {@SuppressWarnings(“deprecation“)@Overridepublic void mouseClicked(MouseEvent arg0) {Mysql myDB = new Mysql();Peration myOper = new Peration(myDB);myOper.xiugaimima(textField.getText(),textField_2.getText(),textField_3.getText());//frame.setVisible(false);//new Login();}});btnNewButton.setFont(new Font(“隶书“, Font.PLAIN, 20));btnNewButton.setBounds(190, 190, 100, 30);btnNewButton.setForeground(Color.DARK_GRAY);frame.getContentPane().add(btnNewButton);JLabel NewLabel = new JLabel();NewLabel.setIcon(img);// -------------------------------------------------------------插入图片NewLabel.setBounds(0, 0, 450, 300);frame.getContentPane().add(NewLabel);frame.setVisible(true);}}package 我要吃豆子;import java.awt.Color;import java.awt.Font;import java.awt.Graphics;import java.awt.event.MouseAdapter;import java.awt.event.MouseEvent;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;public class Gameover {private JFrame frame;private JButton btnNewButton;private JButton btnNewButton2;JLabel lblNewLabel;JLabel lblNewLabel2;JLabel lblNewLabel3;public ImageIcon img = new ImageIcon(“shibai.png“);// 背景图public static void main(String[] args) {new Gameover().frame.setVisible(true);}public Gameover() {chushihua();}private void chushihua() {// 初始化界面frame = new JFrame(“ over “);frame.setBounds(500, 200, 350, 300);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.getContentPane().setLayout(null);// 默认布局lblNewLabel = new JLabel(“真遗憾“);lblNewLabel.setBounds(40, 60, 200, 40);lblNewLabel.setFont(new java.awt.Font(“隶书“, 0, 30));lblNewLabel.setForeground(Color.LIGHT_GRAY);frame.getContentPane().add(lblNewLabel);lblNewLabel2 = new JLabel(“游戏失败“);lblNewLabel2.setBounds(20, 100, 200, 40);lblNewLabel2.setFont(new java.awt.Font(“隶书“, 0, 30));lblNewLabel2.setForeground(Color.LIGHT_GRAY);frame.getContentPane().add(lblNewLabel2);btnNewButton = new JButton(“重新挑战“);btnNewButton.addMouseListener(new MouseAdapter() {@Overridepublic void mouseClicked(MouseEvent arg0) {frame.setVisible(false);new Operation();}});btnNewButton.setFont(new Font(“隶书“, Font.PLAIN, 20));btnNewButton.setBounds(20, 150, 120, 25);btnNewButton.setForeground(Color.DARK_GRAY);frame.getContentPane().add(btnNewButton);btnNewButton2 = new JButton(“返回菜单“);btnNewButton2.addMouseListener(new MouseAdapter() {@Overridepublic void mouseClicked(MouseEvent arg0) {frame.setVisible(false);new Stratgame();// 开始游戏界面}});btnNewButton2.setFont(new Font(“隶书“, Font.PLAIN, 20));btnNewButton2.setBounds(20, 200, 120, 25);btnNewButton2.setForeground(Color.DARK_GRAY);frame.getContentPane().add(btnNewButton2);JLabel NewLabel = new JLabel();NewLabel.setIcon(img);// -------------------------------------------------------------插入图片NewLabel.setBounds(0, 0, 450, 300);frame.getContentPane().add(NewLabel);frame.setVisible(true);}}package 我要吃豆子;import java.awt.Graphics;import java.awt.Rectangle;import javax.swing.ImageIcon;public class Wall {int x, y, w, h; // 墙位置和大小ImageIcon img = new ImageIcon(“wall.png“);// 构造方法public Wall(int x, int y, int w, int h) {super();this.x = x;this.y = y;this.w = w;this.h = h;}// 墙的位置与大小public Rectangle getRect() {return new Rectangle(x, y, w, h);}// 墙图片public void draw(Graphics g) {g.drawImage(img.getImage(), x, y, w, h, null);}}package 我要吃豆子;import java.awt.Graphics;import java.awt.Rectangle;import javax.swing.ImageIcon;public class Gold {int x, y, w, h;// 金币位置和大小private boolean live = true;// 存活ImageIcon img = new ImageIcon(“coins.png“);// 导入图片/* 获取存活状态 */public boolean isLive() {return live;}/* 设置存活状态 */
    展开阅读全文
    1
      金牌文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
    0条评论

    还可以输入200字符

    暂无评论,赶快抢占沙发吧。

    关于本文
    本文标题:吃豆豆游戏.rar
    链接地址:http://www.gold-doc.com/p-255371.html
    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服客服 - 联系我们
    [email protected] 2014-2018 金牌文库网站版权所有
    经营许可证编号:浙ICP备15046084号-3
    收起
    展开