• 大小: 4.24MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-16
  • 语言: Java
  • 标签: java  javaswing  

资源简介

大学实训时候做的课程设计。java swing项目。里面包含数据库文件

资源截图

代码片段和文件信息

package com.huaruiit.deal;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Vector;

import com.huaruiit.Jframe.denglu;
import com.huaruiit.Jframe.denglu;


public class DBUtil {
private final static String DRIVER = “com.mysql.jdbc.Driver“;
private final static String URL = “jdbc:mysql://localhost:3306/huaruiit_gamebox?characterEncoding=utf-8“;
private final static String USER = “root“;
private final static String PASSWORD = “123“;

static{
try {
Class.forName(DRIVER);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
//查询单个数据
public static ResultSet selectSingle(String sql)throws SQLException {
Connection connection = getcon();
Statement stmt = connection.createStatement(); 
return stmt.executeQuery(sql);  
}

public static Connection getcon() throws SQLException
{
Connection connection = DriverManager.getConnection(URL USER PASSWORD);
return connection;
}
//查询商店游戏信息
public static Vectorject>> selectAllgame(){
//储存查询出来数据的空间
Vectorject>> data = new Vectorject>>();
try {
Connection connection =  DBUtil.getcon();
String sql = “SELECT gameinfo_namegameinfo_pri FROM shop_gameinfo“;
//预编译
PreparedStatement ps =  getPreparedStatement(connection sql null);
ResultSet resultSet = DBUtil.query(ps);
while(resultSet.next()){
Vectorject> obj = new Vectorject>();
obj.add(resultSet.getString(“gameinfo_name“));
obj.add(resultSet.getString(“gameinfo_pri“));
data.add(obj);
}
} catch (SQLException e) {
e.printStackTrace();
}
return data;
}
//查询用户游戏信息
public static Vectorject>> selectUserGameInfo(){
//储存查询出来数据的空间
Vectorject>> data = new Vectorject>>();
try {
Connection connection =  DBUtil.getcon();
String sql = “SELECT * FROM “+denglu.loginuser+“_gameinfo“;
//预编译
PreparedStatement ps = getPreparedStatement(connection sql null);
ResultSet resultSet = DBUtil.query(ps);
while(resultSet.next()){
Vectorject> obj = new Vectorject>();
obj.add(resultSet.getString(“usergame_name“));
obj.add(resultSet.getString(“usergame_statu“));
data.add(obj);
}
} catch (SQLException e) {
e.printStackTrace();
}
return data;
}
//查询用户游戏分数信息
public static Vectorject>> selectUserScoreInfo(){
//储存查询出来数据的空间
Vectorject>> data = new Vectorject>>();
try {
Connection connection =  DBUtil.getcon();
String sql = “SELECT * FROM user_score“;
//预编译
PreparedStatement ps = getPreparedStatement(connection sql null);
ResultSet resultSet = DBUtil.query(ps);
while(resultSet.next()){
Vectorject> obj = new Vectorject>();
obj.add(resultSet.getString(“user_n

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        379  2017-10-21 10:38  4+1GameBox\.classpath

     文件        386  2017-10-27 11:02  4+1GameBox\.project

     文件        598  2017-10-19 18:05  4+1GameBox\.settings\org.eclipse.jdt.core.prefs

     文件       4538  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\DBUtil.class

     文件       6395  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\Insertdata.class

     文件       1617  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\shangjiayouxi$1.class

     文件        753  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\shangjiayouxi$2.class

     文件       3208  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\shangjiayouxi.class

     文件       1825  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\showMessage.class

     文件        936  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\xiugaimima$1.class

     文件       1871  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\xiugaimima$2.class

     文件        732  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\xiugaimima$3.class

     文件       4426  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\xiugaimima.class

     文件       2215  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\xiugai_tupian$1.class

     文件        753  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\xiugai_tupian$2.class

     文件       3365  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\xiugai_tupian.class

     文件       2026  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\zhaohuimima$1.class

     文件        741  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\zhaohuimima$2.class

     文件       3286  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\zhaohuimima.class

     文件       1046  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\zhuce$1.class

     文件       2124  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\zhuce$2.class

     文件        705  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\zhuce$3.class

     文件       4484  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\deal\zhuce.class

     文件       4629  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\game\Game.class

     文件        456  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\game\GreedSnake.class

     文件       9269  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\game\lianliankan.class

     文件       8584  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\game\MyListener.class

     文件       4117  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\game\MyPanel.class

     文件        678  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\game\MyWindow$1.class

     文件       2026  2017-10-27 11:02  4+1GameBox\bin\com\huaruiit\game\MyWindow.class

............此处省略214个文件信息

评论

共有 条评论