diff --git a/src/me/xixu/DataBase/TableOperate.java b/src/me/xixu/DataBase/TableOperate.java index 57cfd1b..5ce1882 100644 --- a/src/me/xixu/DataBase/TableOperate.java +++ b/src/me/xixu/DataBase/TableOperate.java @@ -11,23 +11,23 @@ import me.xixu.Static.Information; public class TableOperate { - // 数据库查询连接模板 + // 鏁版嵁搴撴煡璇㈣繛鎺ユā鏉� public TableOperate() { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动!"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩锛�"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库!"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱锛�"); - String sql = "select * from temp"; // 要执行的SQL - ResultSet rs = stmt.executeQuery(sql);// 创建数据对象 - System.out.println("编号" + "\t" + "姓名" + "\t" + "年龄"); + String sql = "select * from temp"; // 瑕佹墽琛岀殑SQL + ResultSet rs = stmt.executeQuery(sql);// 鍒涘缓鏁版嵁瀵硅薄 + System.out.println("缂栧彿" + "\t" + "濮撳悕" + "\t" + "骞撮緞"); while (rs.next()) { System.out.print(rs.getInt(1) + "\t"); System.out.print(rs.getString(2) + "\t"); @@ -42,23 +42,23 @@ public class TableOperate { } } - // 是否存在该用户 + // 鏄惁瀛樺湪璇ョ敤鎴� public static boolean isExist_Customer(String user, String password) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-isExist_Customer"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-isExist_Customer"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-isExist_Customer"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-isExist_Customer"); - String sql = "select * from Customer"; // 要执行的SQL - ResultSet rs = stmt.executeQuery(sql);// 创建数据对象 - System.out.println("用户名" + "\t" + "\t" + "\t" + "密码"); + String sql = "select * from Customer"; // 瑕佹墽琛岀殑SQL + ResultSet rs = stmt.executeQuery(sql);// 鍒涘缓鏁版嵁瀵硅薄 + System.out.println("鐢ㄦ埛鍚�" + "\t" + "\t" + "\t" + "瀵嗙爜"); while (rs.next()) { System.out.print(rs.getString(1) + "\t"); System.out.print(rs.getString(2) + "\t"); @@ -79,23 +79,23 @@ public class TableOperate { return false; } - // 是否存在该管理员 + // 鏄惁瀛樺湪璇ョ鐞嗗憳 public static boolean isExist_Manager(String user, String password) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-isExist_Manager"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-isExist_Manager"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-isExist_Manager"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-isExist_Manager"); - String sql = "select * from Manager"; // 要执行的SQL - ResultSet rs = stmt.executeQuery(sql);// 创建数据对象 - System.out.println("用户名" + "\t" + "\t" + "\t" + "密码"); + String sql = "select * from Manager"; // 瑕佹墽琛岀殑SQL + ResultSet rs = stmt.executeQuery(sql);// 鍒涘缓鏁版嵁瀵硅薄 + System.out.println("鐢ㄦ埛鍚�" + "\t" + "\t" + "\t" + "瀵嗙爜"); while (rs.next()) { System.out.print(rs.getString(1) + "\t"); System.out.print(rs.getString(2) + "\t"); @@ -116,21 +116,21 @@ public class TableOperate { return false; } - // 注册新用户 + // 娉ㄥ唽鏂扮敤鎴� public static void regist_Customer(String user, String password) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-regist_Customer"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-regist_Customer"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-regist_Customer"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-regist_Customer"); - String sql = "insert into Customer values('" + user + "','" + password + "');"; // 要执行的SQL + String sql = "insert into Customer values('" + user + "','" + password + "');"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts = conn.prepareStatement(sql); stmts.executeUpdate(); @@ -143,21 +143,21 @@ public class TableOperate { } } - // 注册新管理员 + // 娉ㄥ唽鏂扮鐞嗗憳 public static void regist_Manager(String user, String password) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-regist_Manager"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-regist_Manager"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-regist_Manager"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-regist_Manager"); - String sql = "insert into Manager values('" + user + "','" + password + "');"; // 要执行的SQL + String sql = "insert into Manager values('" + user + "','" + password + "');"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts = conn.prepareStatement(sql); stmts.executeUpdate(); @@ -170,22 +170,22 @@ public class TableOperate { } } - // 改变用户的密码 + // 鏀瑰彉鐢ㄦ埛鐨勫瘑鐮� public static void changePassword_Customer(String user, String password, String newPassword) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-changePassword"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-changePassword"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-changePassword"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-changePassword"); String sql = "update Customer set customer_password = '" + newPassword + "' where customer_user = '" + user - + "';"; // 要执行的SQL + + "';"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts = conn.prepareStatement(sql); stmts.executeUpdate(); @@ -198,22 +198,22 @@ public class TableOperate { } } - // 改变管理员的密码 + // 鏀瑰彉绠$悊鍛樼殑瀵嗙爜 public static void changePassword_Manager(String user, String password, String newPassword) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-changePassword"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-changePassword"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-changePassword"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-changePassword"); String sql = "update Manager set manager_password = '" + newPassword + "' where manager_user = '" + user - + "';"; // 要执行的SQL + + "';"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts = conn.prepareStatement(sql); stmts.executeUpdate(); @@ -226,23 +226,23 @@ public class TableOperate { } } - // 是否存在该用户名 + // 鏄惁瀛樺湪璇ョ敤鎴峰悕 public static boolean isExist_Customer_user(String user, String password) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-isExist_Customer"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-isExist_Customer"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-isExist_Customer"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-isExist_Customer"); - String sql = "select * from Customer"; // 要执行的SQL - ResultSet rs = stmt.executeQuery(sql);// 创建数据对象 - System.out.println("用户名" + "\t" + "\t" + "\t" + "密码"); + String sql = "select * from Customer"; // 瑕佹墽琛岀殑SQL + ResultSet rs = stmt.executeQuery(sql);// 鍒涘缓鏁版嵁瀵硅薄 + System.out.println("鐢ㄦ埛鍚�" + "\t" + "\t" + "\t" + "瀵嗙爜"); while (rs.next()) { System.out.print(rs.getString(1) + "\t"); System.out.print(rs.getString(2) + "\t"); @@ -263,23 +263,23 @@ public class TableOperate { return false; } - // 是否存在该管理员名称 + // 鏄惁瀛樺湪璇ョ鐞嗗憳鍚嶇О public static boolean isExist_Manager_user(String user, String password) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-isExist_Manager"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-isExist_Manager"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-isExist_Manager"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-isExist_Manager"); - String sql = "select * from Manager"; // 要执行的SQL - ResultSet rs = stmt.executeQuery(sql);// 创建数据对象 - System.out.println("用户名" + "\t" + "\t" + "\t" + "密码"); + String sql = "select * from Manager"; // 瑕佹墽琛岀殑SQL + ResultSet rs = stmt.executeQuery(sql);// 鍒涘缓鏁版嵁瀵硅薄 + System.out.println("鐢ㄦ埛鍚�" + "\t" + "\t" + "\t" + "瀵嗙爜"); while (rs.next()) { System.out.print(rs.getString(1) + "\t"); System.out.print(rs.getString(2) + "\t"); @@ -300,23 +300,23 @@ public class TableOperate { return false; } - // 插入新书 + // 鎻掑叆鏂颁功 public static void insertBook(String number, String classnumber, String name, String classname, String price, String state, String total) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-insertBook"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-insertBook"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-insertBook"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-insertBook"); String sql = "insert into " + classname + "Book" + " values('" + number + "','" + classnumber + "','" + name - + "','" + classname + "','" + price + "','" + state + "','" + total + "','null','null','null');"; // 要执行的SQL + + "','" + classname + "','" + price + "','" + state + "','" + total + "','null','null','null');"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts = conn.prepareStatement(sql); stmts.executeUpdate(); @@ -329,22 +329,22 @@ public class TableOperate { } } - // 新建类别 + // 鏂板缓绫诲埆 public static void newClass(String classnumber, String classname) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-newClass"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-newClass"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-newClass"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-newClass"); String sql = "CREATE TABLE " + classname - + "Book(number VARCHAR(255) primary key,classnumber VARCHAR(255),name VARCHAR(255),classname VARCHAR(255),price VARCHAR(255),state VARCHAR(255),total VARCHAR(255),current VARCHAR(255),dateon VARCHAR(255),dateoff VARCHAR(255));"; // 要执行的SQL + + "Book(number VARCHAR(255) primary key,classnumber VARCHAR(255),name VARCHAR(255),classname VARCHAR(255),price VARCHAR(255),state VARCHAR(255),total VARCHAR(255),current VARCHAR(255),dateon VARCHAR(255),dateoff VARCHAR(255));"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts = conn.prepareStatement(sql); stmts.executeUpdate(); @@ -357,21 +357,21 @@ public class TableOperate { } } - // 删除书籍信息 + // 鍒犻櫎涔︾睄淇℃伅 public static void deleteBook(String number, String classname) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-deleteBook"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-deleteBook"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-deleteBook"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-deleteBook"); - String sql = "delete from " + classname + "Book where number = '" + number + "';"; // 要执行的SQL + String sql = "delete from " + classname + "Book where number = '" + number + "';"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts = conn.prepareStatement(sql); stmts.executeUpdate(); @@ -384,24 +384,24 @@ public class TableOperate { } } - // 查询某类图书信息 + // 鏌ヨ鏌愮被鍥句功淇℃伅 public static void search_classname(String classname) { Information.bookarray.clear(); try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-search_classname"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-search_classname"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-search_classname"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-search_classname"); - String sql = "select * from " + classname + "Book;"; // 要执行的SQL - ResultSet rs = stmt.executeQuery(sql);// 创建数据对象 + String sql = "select * from " + classname + "Book;"; // 瑕佹墽琛岀殑SQL + ResultSet rs = stmt.executeQuery(sql);// 鍒涘缓鏁版嵁瀵硅薄 while (rs.next()) { Book book = new Book(); book.number = rs.getString(1); @@ -424,21 +424,21 @@ public class TableOperate { } } - // 借书更改信息 + // 鍊熶功鏇存敼淇℃伅 public static void borrowBook_Update(String classname, String number, String user, String dateoff) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-borrowBook_Customer"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-borrowBook_Customer"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-borrowBook_Customer"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-borrowBook_Customer"); - String sql = "update " + classname + "Book set state = 'out' where number = '" + number + "';\n"; // 要执行的SQL + String sql = "update " + classname + "Book set state = 'out' where number = '" + number + "';\n"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts_state = conn.prepareStatement(sql); stmts_state.executeUpdate(); stmts_state.close(); @@ -460,22 +460,22 @@ public class TableOperate { } } - // 创建用户数据库 + // 鍒涘缓鐢ㄦ埛鏁版嵁搴� public static void newCustomer(String user) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-newCustomer"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-newCustomer"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-newCustomer"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-newCustomer"); String sql = "CREATE TABLE " + user - + "Customer (number VARCHAR(255) primary key,classname VARCHAR(255),name VARCHAR(255),dateoff VARCHAR(255));"; // 要执行的SQL + + "Customer (number VARCHAR(255) primary key,classname VARCHAR(255),name VARCHAR(255),dateoff VARCHAR(255));"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts = conn.prepareStatement(sql); stmts.executeUpdate(); @@ -488,22 +488,22 @@ public class TableOperate { } } - // 借书注射到用户信息 + // 鍊熶功娉ㄥ皠鍒扮敤鎴蜂俊鎭� public static void borrowBook_Insert(String classname, String number, String user, String dateoff) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-borrowBook_Insert"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-borrowBook_Insert"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-borrowBook_Insert"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-borrowBook_Insert"); String sql = "insert into " + user + "Customer values('" + number + "','" + classname + "','" - + search_bookname(classname, number) + "','" + dateoff + "');"; // 要执行的SQL + + search_bookname(classname, number) + "','" + dateoff + "');"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts = conn.prepareStatement(sql); stmts.executeUpdate(); @@ -516,21 +516,21 @@ public class TableOperate { } } - // 还书更新书籍数据库信息 + // 杩樹功鏇存柊涔︾睄鏁版嵁搴撲俊鎭� public static void returnBook_Update(String classname, String number, String user, String dateoff) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-returnBook_Update"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-returnBook_Update"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-returnBook_Update"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-returnBook_Update"); - String sql = "update " + classname + "Book set state = 'in' where number = '" + number + "';\n"; // 要执行的SQL + String sql = "update " + classname + "Book set state = 'in' where number = '" + number + "';\n"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts_state = conn.prepareStatement(sql); stmts_state.executeUpdate(); stmts_state.close(); @@ -552,21 +552,21 @@ public class TableOperate { } } - // 还书更新用户的数据库信息 + // 杩樹功鏇存柊鐢ㄦ埛鐨勬暟鎹簱淇℃伅 public static void returnBook_Delete(String number, String user) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-returnBook_Delete"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-returnBook_Delete"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-returnBook_Delete"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-returnBook_Delete"); - String sql = "delete from " + user + "Customer where number = '" + number + "';"; // 要执行的SQL + String sql = "delete from " + user + "Customer where number = '" + number + "';"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts = conn.prepareStatement(sql); stmts.executeUpdate(); @@ -579,22 +579,22 @@ public class TableOperate { } } - // 续借更新两者数据库信息 + // 缁�熸洿鏂颁袱鑰呮暟鎹簱淇℃伅 public static void prolongBook_Update(String classname, String number, String dateoff, String user) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-prolongBook_Update"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-prolongBook_Update"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-prolongBook_Update"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-prolongBook_Update"); String sql = "update " + classname + "Book set dateoff = '" + dateoff + "' where number = '" + number - + "';\n"; // 要执行的SQL + + "';\n"; // 瑕佹墽琛岀殑SQL PreparedStatement stmts_state = conn.prepareStatement(sql); stmts_state.executeUpdate(); stmts_state.close(); @@ -611,24 +611,24 @@ public class TableOperate { } } - // 查询个人图书信息 + // 鏌ヨ涓汉鍥句功淇℃伅 public static void search_personal(String user) { Information.bookarray.clear(); try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-search_personal"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-search_personal"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-search_personal"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-search_personal"); - String sql = "select * from " + user + "Customer;"; // 要执行的SQL - ResultSet rs = stmt.executeQuery(sql);// 创建数据对象 + String sql = "select * from " + user + "Customer;"; // 瑕佹墽琛岀殑SQL + ResultSet rs = stmt.executeQuery(sql);// 鍒涘缓鏁版嵁瀵硅薄 while (rs.next()) { Book book = new Book(); book.number = rs.getString(1); @@ -645,22 +645,22 @@ public class TableOperate { } } - // 是否存在该Table表 + // 鏄惁瀛樺湪璇able琛� public static boolean isExist_Table(String table) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-isExist_Table"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-isExist_Table"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-isExist_Table"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-isExist_Table"); - String sql = "show tables"; // 要执行的SQL - ResultSet rs = stmt.executeQuery(sql);// 创建数据对象 + String sql = "show tables"; // 瑕佹墽琛岀殑SQL + ResultSet rs = stmt.executeQuery(sql);// 鍒涘缓鏁版嵁瀵硅薄 while (rs.next()) { if (table.equals(rs.getString(1))) { return true; @@ -675,22 +675,22 @@ public class TableOperate { return false; } - // 查找书名 + // 鏌ユ壘涔﹀悕 public static String search_bookname(String classname, String number) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-search_bookname"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-search_bookname"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-search_bookname"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-search_bookname"); - String sql = "select * from " + classname + "book where number='" + number + "';"; // 要执行的SQL - ResultSet rs = stmt.executeQuery(sql);// 创建数据对象 + String sql = "select * from " + classname + "book where number='" + number + "';"; // 瑕佹墽琛岀殑SQL + ResultSet rs = stmt.executeQuery(sql);// 鍒涘缓鏁版嵁瀵硅薄 while (rs.next()) { return rs.getString(3); } @@ -703,22 +703,22 @@ public class TableOperate { return "null"; } - // 查找书籍状态 + // 鏌ユ壘涔︾睄鐘舵�� public static String search_bookstate(String classname, String number) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-search_bookstate"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-search_bookstate"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-search_bookstate"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-search_bookstate"); - String sql = "select * from " + classname + "book where number='" + number + "';"; // 要执行的SQL - ResultSet rs = stmt.executeQuery(sql);// 创建数据对象 + String sql = "select * from " + classname + "book where number='" + number + "';"; // 瑕佹墽琛岀殑SQL + ResultSet rs = stmt.executeQuery(sql);// 鍒涘缓鏁版嵁瀵硅薄 while (rs.next()) { return rs.getString(6); } @@ -731,22 +731,22 @@ public class TableOperate { return "null"; } - // 查找书籍还书日期 + // 鏌ユ壘涔︾睄杩樹功鏃ユ湡 public static int search_bookdateoff(String classname, String number) { try { - // 调用Class.forName()方法加载驱动程序 + // 璋冪敤Class.forName()鏂规硶鍔犺浇椹卞姩绋嬪簭 Class.forName("com.mysql.jdbc.Driver"); - System.out.println("成功加载MySQL驱动-search_bookdateoff"); + System.out.println("鎴愬姛鍔犺浇MySQL椹卞姩-search_bookdateoff"); - String url = Information.JDBC_URL; // JDBC的URL + String url = Information.JDBC_URL; // JDBC鐨刄RL Connection conn; conn = DriverManager.getConnection(url, Information.username, Information.password); - Statement stmt = conn.createStatement(); // 创建Statement对象 - System.out.println("成功连接到数据库-search_bookdateoff"); + Statement stmt = conn.createStatement(); // 鍒涘缓Statement瀵硅薄 + System.out.println("鎴愬姛杩炴帴鍒版暟鎹簱-search_bookdateoff"); - String sql = "select * from " + classname + "book where number='" + number + "';"; // 要执行的SQL - ResultSet rs = stmt.executeQuery(sql);// 创建数据对象 + String sql = "select * from " + classname + "book where number='" + number + "';"; // 瑕佹墽琛岀殑SQL + ResultSet rs = stmt.executeQuery(sql);// 鍒涘缓鏁版嵁瀵硅薄 while (rs.next()) { return Integer.parseInt(rs.getString(10)); } diff --git a/src/me/xixu/MainInterface.java b/src/me/xixu/MainInterface.java index 58307ac..05bf1d1 100644 --- a/src/me/xixu/MainInterface.java +++ b/src/me/xixu/MainInterface.java @@ -34,23 +34,23 @@ import me.xixu.User.UserInterface; public class MainInterface extends JFrame implements ActionListener { - // Main窗口 + // Main绐楀彛 public static JPanel contentPane; - // Manager窗口 + // Manager绐楀彛 public static ManagerInterface managerJPanel = new ManagerInterface(); public static InsertBook insertJPanel = new InsertBook(); public static NewClass newJPanel = new NewClass(); public static UpdateBook updateJPanel = new UpdateBook(); public static State stateJPanel = new State(); public static State_Information stateInfoJPanel = new State_Information(); - // User窗口 + // User绐楀彛 public static UserInterface userJPanel = new UserInterface(); public static BorrowBook borrowJPanel = new BorrowBook(); public static BorrowBook_Information borrowInfoJPanel = new BorrowBook_Information(); public static ReturnBook returnJPanel = new ReturnBook(); public static ProlongBook prolongJPanel = new ProlongBook(); public static PersonalInformation personalJPanel = new PersonalInformation(); - // 主界面窗口 + // 涓荤晫闈㈢獥鍙� private JTextField tf_user; private JTextField tf_password; private JLabel label_user; @@ -79,13 +79,13 @@ public class MainInterface extends JFrame implements ActionListener { init(); } - // 初始化窗口 + // 鍒濆鍖栫獥鍙� public void init() { - // 获取主界面容器 + // 鑾峰彇涓荤晫闈㈠鍣� container = getContentPane(); - // 初始化主界面 + // 鍒濆鍖栦富鐣岄潰 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(800, 400, 1300, 1000); setResizable(false); @@ -95,83 +95,83 @@ public class MainInterface extends JFrame implements ActionListener { container.add(contentPane); contentPane.setLayout(null); - // 账号输入框 + // 璐﹀彿杈撳叆妗� tf_user = new JTextField(); - tf_user.setFont(new Font("宋体", Font.BOLD, 35)); + tf_user.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_user.setBounds(409, 248, 526, 75); contentPane.add(tf_user); tf_user.setColumns(10); - // 密码输入框 + // 瀵嗙爜杈撳叆妗� tf_password = new JTextField(); - tf_password.setFont(new Font("宋体", Font.BOLD, 35)); + tf_password.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_password.setColumns(10); tf_password.setBounds(409, 357, 526, 75); contentPane.add(tf_password); - // 用户名标签 + // 鐢ㄦ埛鍚嶆爣绛� label_user = new JLabel("\u8D26\u53F7\uFF1A"); - label_user.setFont(new Font("宋体", Font.BOLD, 35)); + label_user.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); label_user.setBounds(289, 261, 116, 48); contentPane.add(label_user); - // 密码标签 + // 瀵嗙爜鏍囩 label_password = new JLabel("\u5BC6\u7801\uFF1A"); - label_password.setFont(new Font("宋体", Font.BOLD, 35)); + label_password.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); label_password.setBounds(289, 370, 116, 48); contentPane.add(label_password); - // 普通用户单选按钮 + // 鏅�氱敤鎴峰崟閫夋寜閽� rb_customer = new JRadioButton("\u666E\u901A\u7528\u6237"); rb_customer.setSelected(true); - rb_customer.setFont(new Font("宋体", Font.BOLD, 30)); + rb_customer.setFont(new Font("瀹嬩綋", Font.BOLD, 30)); rb_customer.setBackground(Color.WHITE); rb_customer.setBounds(409, 515, 170, 37); contentPane.add(rb_customer); - // 管理人员单选按钮 + // 绠$悊浜哄憳鍗曢�夋寜閽� rb_manager = new JRadioButton("\u7BA1\u7406\u4EBA\u5458"); - rb_manager.setFont(new Font("宋体", Font.BOLD, 30)); + rb_manager.setFont(new Font("瀹嬩綋", Font.BOLD, 30)); rb_manager.setBackground(Color.WHITE); rb_manager.setBounds(765, 515, 170, 37); contentPane.add(rb_manager); - // 将选项按钮添加到一个按钮组 - ButtonGroup bg = new ButtonGroup();// 初始化按钮组 - bg.add(rb_customer);// 普通用户加入按钮组 - bg.add(rb_manager);// 管理人员加入按钮组 + // 灏嗛�夐」鎸夐挳娣诲姞鍒颁竴涓寜閽粍 + ButtonGroup bg = new ButtonGroup();// 鍒濆鍖栨寜閽粍 + bg.add(rb_customer);// 鏅�氱敤鎴峰姞鍏ユ寜閽粍 + bg.add(rb_manager);// 绠$悊浜哄憳鍔犲叆鎸夐挳缁� - // 登录按钮 + // 鐧诲綍鎸夐挳 btn_login = new JButton("\u767B\u5F55"); btn_login.setBackground(Color.LIGHT_GRAY); - btn_login.setFont(new Font("宋体", Font.BOLD, 35)); + btn_login.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); btn_login.setBounds(409, 634, 170, 48); contentPane.add(btn_login); btn_login.addActionListener(this); - // 注册按钮 + // 娉ㄥ唽鎸夐挳 btn_register = new JButton("\u6CE8\u518C"); - btn_register.setFont(new Font("宋体", Font.BOLD, 35)); + btn_register.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); btn_register.setBackground(Color.LIGHT_GRAY); btn_register.setBounds(765, 634, 170, 48); contentPane.add(btn_register); btn_register.addActionListener(this); - // 修改密码按钮 + // 淇敼瀵嗙爜鎸夐挳 btn_changePassword = new JButton("\u4FEE\u6539\u5BC6\u7801"); - btn_changePassword.setFont(new Font("宋体", Font.BOLD, 30)); + btn_changePassword.setFont(new Font("瀹嬩綋", Font.BOLD, 30)); btn_changePassword.setBackground(Color.LIGHT_GRAY); btn_changePassword.setBounds(1011, 370, 170, 48); contentPane.add(btn_changePassword); label = new JLabel("\u56FE\u4E66\u7BA1\u7406\u7CFB\u7EDF"); label.setHorizontalAlignment(SwingConstants.CENTER); - label.setFont(new Font("宋体", Font.BOLD, 40)); + label.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); label.setBounds(529, 69, 294, 105); contentPane.add(label); btn_changePassword.addActionListener(this); } - // 切换窗口函数 + // 鍒囨崲绐楀彛鍑芥暟 // Main->Manager public static void MaintoManager() { if (!flage_manager) { @@ -388,104 +388,104 @@ public class MainInterface extends JFrame implements ActionListener { userJPanel.setVisible(true); } - // 登录注册事件函数 + // 鐧诲綍娉ㄥ唽浜嬩欢鍑芥暟 @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == btn_login) { - // 点击登录按钮 - // 判定用户名密码是否为空 + // 鐐瑰嚮鐧诲綍鎸夐挳 + // 鍒ゅ畾鐢ㄦ埛鍚嶅瘑鐮佹槸鍚︿负绌� if (tf_user.getText().equals("")) { - JOptionPane.showMessageDialog(null, "用户名不能为空", "登录失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "鐢ㄦ埛鍚嶄笉鑳戒负绌�", "鐧诲綍澶辫触", JOptionPane.ERROR_MESSAGE); } else if (tf_password.getText().equals("")) { - JOptionPane.showMessageDialog(null, "密码不能为空", "登录失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "瀵嗙爜涓嶈兘涓虹┖", "鐧诲綍澶辫触", JOptionPane.ERROR_MESSAGE); } else { - // 判定是用户还是管理员 + // 鍒ゅ畾鏄敤鎴疯繕鏄鐞嗗憳 if (rb_customer.isSelected()) { - // 用户 + // 鐢ㄦ埛 boolean isExist = TableOperate.isExist_Customer(tf_user.getText(), tf_password.getText()); if (isExist) { - JOptionPane.showMessageDialog(null, "欢迎使用", "用户登录成功", JOptionPane.OK_CANCEL_OPTION); + JOptionPane.showMessageDialog(null, "娆㈣繋浣跨敤", "鐢ㄦ埛鐧诲綍鎴愬姛", JOptionPane.OK_CANCEL_OPTION); Information.user = tf_user.getText(); UserInterface.setUser(); MaintoUser(); } else { - JOptionPane.showMessageDialog(null, "请输入正确的用户名密码", "用户登录失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "璇疯緭鍏ユ纭殑鐢ㄦ埛鍚嶅瘑鐮�", "鐢ㄦ埛鐧诲綍澶辫触", JOptionPane.ERROR_MESSAGE); } } else { - // 管理员 + // 绠$悊鍛� boolean isExist = TableOperate.isExist_Manager(tf_user.getText(), tf_password.getText()); if (isExist) { - JOptionPane.showMessageDialog(null, "欢迎使用", "管理员登录成功", JOptionPane.OK_CANCEL_OPTION); + JOptionPane.showMessageDialog(null, "娆㈣繋浣跨敤", "绠$悊鍛樼櫥褰曟垚鍔�", JOptionPane.OK_CANCEL_OPTION); Information.manager = tf_user.getText(); ManagerInterface.setManager(); MaintoManager(); } else { - JOptionPane.showMessageDialog(null, "请输入正确的用户名密码", "管理员登录失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "璇疯緭鍏ユ纭殑鐢ㄦ埛鍚嶅瘑鐮�", "绠$悊鍛樼櫥褰曞け璐�", JOptionPane.ERROR_MESSAGE); } } } } else if (e.getSource() == btn_register) { - // 点击注册按钮 - // 判定用户名密码是否为空 + // 鐐瑰嚮娉ㄥ唽鎸夐挳 + // 鍒ゅ畾鐢ㄦ埛鍚嶅瘑鐮佹槸鍚︿负绌� if (tf_user.getText().equals("")) { - JOptionPane.showMessageDialog(null, "用户名不能为空", "注册失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "鐢ㄦ埛鍚嶄笉鑳戒负绌�", "娉ㄥ唽澶辫触", JOptionPane.ERROR_MESSAGE); } else if (tf_password.getText().equals("")) { - JOptionPane.showMessageDialog(null, "密码不能为空", "注册失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "瀵嗙爜涓嶈兘涓虹┖", "娉ㄥ唽澶辫触", JOptionPane.ERROR_MESSAGE); } else { - // 判定是用户还是管理员 + // 鍒ゅ畾鏄敤鎴疯繕鏄鐞嗗憳 if (rb_customer.isSelected()) { boolean isExist = TableOperate.isExist_Customer_user(tf_user.getText(), tf_password.getText()); if (isExist) { - JOptionPane.showMessageDialog(null, "该用户已经存在", "用户注册失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "璇ョ敤鎴峰凡缁忓瓨鍦�", "鐢ㄦ埛娉ㄥ唽澶辫触", JOptionPane.ERROR_MESSAGE); } else { - JOptionPane.showMessageDialog(null, "欢迎!", "用户注册成功", JOptionPane.OK_CANCEL_OPTION); + JOptionPane.showMessageDialog(null, "娆㈣繋锛�", "鐢ㄦ埛娉ㄥ唽鎴愬姛", JOptionPane.OK_CANCEL_OPTION); TableOperate.regist_Customer(tf_user.getText(), tf_password.getText()); TableOperate.newCustomer(tf_user.getText()); } } else { boolean isExist = TableOperate.isExist_Manager_user(tf_user.getText(), tf_password.getText()); if (isExist) { - JOptionPane.showMessageDialog(null, "该管理员已经存在", "管理员注册失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "璇ョ鐞嗗憳宸茬粡瀛樺湪", "绠$悊鍛樻敞鍐屽け璐�", JOptionPane.ERROR_MESSAGE); } else { - JOptionPane.showMessageDialog(null, "欢迎!", "管理员注册成功", JOptionPane.OK_CANCEL_OPTION); + JOptionPane.showMessageDialog(null, "娆㈣繋锛�", "绠$悊鍛樻敞鍐屾垚鍔�", JOptionPane.OK_CANCEL_OPTION); TableOperate.regist_Manager(tf_user.getText(), tf_password.getText()); } } } } else if (e.getSource() == btn_changePassword) { if (tf_user.getText().equals("")) { - JOptionPane.showMessageDialog(null, "用户名不能为空", "修改失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "鐢ㄦ埛鍚嶄笉鑳戒负绌�", "淇敼澶辫触", JOptionPane.ERROR_MESSAGE); } else if (tf_password.getText().equals("")) { - JOptionPane.showMessageDialog(null, "密码不能为空", "修改失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "瀵嗙爜涓嶈兘涓虹┖", "淇敼澶辫触", JOptionPane.ERROR_MESSAGE); } else { - // 判定是用户还是管理员 + // 鍒ゅ畾鏄敤鎴疯繕鏄鐞嗗憳 if (rb_customer.isSelected()) { - // 用户 + // 鐢ㄦ埛 boolean isExist = TableOperate.isExist_Customer(tf_user.getText(), tf_password.getText()); if (isExist) { - String newPassword = JOptionPane.showInputDialog("请输入新密码"); + String newPassword = JOptionPane.showInputDialog("璇疯緭鍏ユ柊瀵嗙爜"); if (!newPassword.equals("")) { TableOperate.changePassword_Customer(tf_user.getText(), tf_password.getText(), newPassword); - JOptionPane.showMessageDialog(null, "欢迎使用", "修改密码成功", JOptionPane.OK_CANCEL_OPTION); + JOptionPane.showMessageDialog(null, "娆㈣繋浣跨敤", "淇敼瀵嗙爜鎴愬姛", JOptionPane.OK_CANCEL_OPTION); } else { - JOptionPane.showMessageDialog(null, "密码不能为空", "修改密码失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "瀵嗙爜涓嶈兘涓虹┖", "淇敼瀵嗙爜澶辫触", JOptionPane.ERROR_MESSAGE); } } else { - JOptionPane.showMessageDialog(null, "请输入正确的用户名密码", "修改密码失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "璇疯緭鍏ユ纭殑鐢ㄦ埛鍚嶅瘑鐮�", "淇敼瀵嗙爜澶辫触", JOptionPane.ERROR_MESSAGE); } } else { - // 管理员 + // 绠$悊鍛� boolean isExist = TableOperate.isExist_Manager(tf_user.getText(), tf_password.getText()); if (isExist) { - String newPassword = JOptionPane.showInputDialog("请输入新密码"); + String newPassword = JOptionPane.showInputDialog("璇疯緭鍏ユ柊瀵嗙爜"); if (!newPassword.equals("")) { TableOperate.changePassword_Manager(tf_user.getText(), tf_password.getText(), newPassword); - JOptionPane.showMessageDialog(null, "欢迎使用", "修改密码成功", JOptionPane.OK_CANCEL_OPTION); + JOptionPane.showMessageDialog(null, "娆㈣繋浣跨敤", "淇敼瀵嗙爜鎴愬姛", JOptionPane.OK_CANCEL_OPTION); } else { - JOptionPane.showMessageDialog(null, "密码不能为空", "修改密码失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "瀵嗙爜涓嶈兘涓虹┖", "淇敼瀵嗙爜澶辫触", JOptionPane.ERROR_MESSAGE); } } else { - JOptionPane.showMessageDialog(null, "请输入正确的用户名密码", "修改密码失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "璇疯緭鍏ユ纭殑鐢ㄦ埛鍚嶅瘑鐮�", "淇敼瀵嗙爜澶辫触", JOptionPane.ERROR_MESSAGE); } } } diff --git a/src/me/xixu/Manager/InsertBook.java b/src/me/xixu/Manager/InsertBook.java index ce2394d..f50b224 100644 --- a/src/me/xixu/Manager/InsertBook.java +++ b/src/me/xixu/Manager/InsertBook.java @@ -42,95 +42,95 @@ public class InsertBook extends JPanel implements ActionListener { JLabel label = new JLabel("\u65B0\u4E66\u5F55\u5165"); label.setHorizontalAlignment(SwingConstants.CENTER); - label.setFont(new Font("宋体", Font.BOLD, 40)); + label.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); label.setBounds(530, 0, 294, 105); add(label); lb_number = new JLabel("\u7F16\u53F7\uFF1A"); - lb_number.setFont(new Font("宋体", Font.BOLD, 35)); + lb_number.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_number.setBounds(293, 137, 194, 55); add(lb_number); tf_number = new JTextField(); - tf_number.setFont(new Font("宋体", Font.BOLD, 35)); + tf_number.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_number.setColumns(10); tf_number.setBounds(486, 127, 526, 75); add(tf_number); lb_classnumber = new JLabel("\u5206\u7C7B\u7F16\u53F7\uFF1A"); - lb_classnumber.setFont(new Font("宋体", Font.BOLD, 35)); + lb_classnumber.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_classnumber.setBounds(293, 233, 194, 55); add(lb_classnumber); lb_name = new JLabel("\u4E66\u540D\uFF1A"); - lb_name.setFont(new Font("宋体", Font.BOLD, 35)); + lb_name.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_name.setBounds(293, 329, 194, 55); add(lb_name); lb_classname = new JLabel("\u5206\u7C7B\u540D\u79F0\uFF1A"); - lb_classname.setFont(new Font("宋体", Font.BOLD, 35)); + lb_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_classname.setBounds(293, 435, 194, 55); add(lb_classname); lb_price = new JLabel("\u4EF7\u683C\uFF1A"); - lb_price.setFont(new Font("宋体", Font.BOLD, 35)); + lb_price.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_price.setBounds(293, 521, 194, 55); add(lb_price); lb_state = new JLabel("\u5165\u85CF\u72B6\u6001\uFF1A"); - lb_state.setFont(new Font("宋体", Font.BOLD, 35)); + lb_state.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_state.setBounds(293, 617, 194, 55); add(lb_state); lb_total = new JLabel("\u6570\u91CF\uFF1A"); - lb_total.setFont(new Font("宋体", Font.BOLD, 35)); + lb_total.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_total.setBounds(293, 713, 194, 55); add(lb_total); tf_classnumber = new JTextField(); - tf_classnumber.setFont(new Font("宋体", Font.BOLD, 35)); + tf_classnumber.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_classnumber.setColumns(10); tf_classnumber.setBounds(486, 223, 526, 75); add(tf_classnumber); tf_name = new JTextField(); - tf_name.setFont(new Font("宋体", Font.BOLD, 35)); + tf_name.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_name.setColumns(10); tf_name.setBounds(486, 319, 526, 75); add(tf_name); tf_classname = new JTextField(); - tf_classname.setFont(new Font("宋体", Font.BOLD, 35)); + tf_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_classname.setColumns(10); tf_classname.setBounds(486, 415, 526, 75); add(tf_classname); tf_price = new JTextField(); - tf_price.setFont(new Font("宋体", Font.BOLD, 35)); + tf_price.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_price.setColumns(10); tf_price.setBounds(486, 511, 526, 75); add(tf_price); tf_state = new JTextField(); - tf_state.setFont(new Font("宋体", Font.BOLD, 35)); + tf_state.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_state.setColumns(10); tf_state.setBounds(486, 607, 526, 75); add(tf_state); tf_total = new JTextField(); - tf_total.setFont(new Font("宋体", Font.BOLD, 35)); + tf_total.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_total.setColumns(10); tf_total.setBounds(486, 703, 526, 75); add(tf_total); btn_submit = new JButton("\u63D0\u4EA4"); - btn_submit.setFont(new Font("宋体", Font.BOLD, 35)); + btn_submit.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); btn_submit.setBounds(573, 833, 251, 80); add(btn_submit); btn_submit.addActionListener(this); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); @@ -140,11 +140,11 @@ public class InsertBook extends JPanel implements ActionListener { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == back) { - // 点击返回按钮 + // 鐐瑰嚮杩斿洖鎸夐挳 MainInterface.InserttoManager(); } else if (e.getSource() == btn_submit) { - // 点击提交按钮 - // 判定录入信息是否冲突 + // 鐐瑰嚮鎻愪氦鎸夐挳 + // 鍒ゅ畾褰曞叆淇℃伅鏄惁鍐茬獊 String number = tf_number.getText(); String classnumber = tf_classnumber.getText(); String name = tf_name.getText(); @@ -154,7 +154,7 @@ public class InsertBook extends JPanel implements ActionListener { String total = tf_total.getText(); if (TableOperate.search_bookstate(classname, number).equals("null")) { - // 插入书籍信息 + // 鎻掑叆涔︾睄淇℃伅 TableOperate.insertBook(number, classnumber, name, classname, price, state, total); tf_number.setText(""); tf_classnumber.setText(""); @@ -163,9 +163,9 @@ public class InsertBook extends JPanel implements ActionListener { tf_price.setText(""); tf_state.setText(""); tf_total.setText(""); - JOptionPane.showMessageDialog(null, "恭喜", "书籍录入成功", JOptionPane.OK_CANCEL_OPTION); + JOptionPane.showMessageDialog(null, "鎭枩", "涔︾睄褰曞叆鎴愬姛", JOptionPane.OK_CANCEL_OPTION); } else { - JOptionPane.showMessageDialog(null, "书籍信息冲突", "书籍录入失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "涔︾睄淇℃伅鍐茬獊", "涔︾睄褰曞叆澶辫触", JOptionPane.ERROR_MESSAGE); } } } diff --git a/src/me/xixu/Manager/ManagerInterface.java b/src/me/xixu/Manager/ManagerInterface.java index 8840914..cbe6b71 100644 --- a/src/me/xixu/Manager/ManagerInterface.java +++ b/src/me/xixu/Manager/ManagerInterface.java @@ -31,51 +31,51 @@ public class ManagerInterface extends JPanel implements ActionListener { label = new JLabel("\u7BA1\u7406\u5458\u754C\u9762"); label.setHorizontalAlignment(SwingConstants.CENTER); - label.setFont(new Font("宋体", Font.BOLD, 40)); + label.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); label.setBounds(530, 20, 294, 105); add(label); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); btn_insertBook = new JButton("\u5F55\u5165\u65B0\u4E66"); - btn_insertBook.setFont(new Font("宋体", Font.BOLD, 40)); + btn_insertBook.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); btn_insertBook.setBounds(21, 241, 280, 505); add(btn_insertBook); btn_insertBook.addActionListener(this); btn_newClass = new JButton("\u8BBE\u7ACB\u65B0\u7C7B\u522B"); - btn_newClass.setFont(new Font("宋体", Font.BOLD, 40)); + btn_newClass.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); btn_newClass.setBounds(347, 241, 280, 505); add(btn_newClass); btn_newClass.addActionListener(this); btn_updateBook = new JButton("\u66F4\u65B0\u4FE1\u606F"); - btn_updateBook.setFont(new Font("宋体", Font.BOLD, 40)); + btn_updateBook.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); btn_updateBook.setBounds(673, 241, 280, 505); add(btn_updateBook); btn_updateBook.addActionListener(this); btn_state = new JButton("\u9986\u85CF\u72B6\u6001"); - btn_state.setFont(new Font("宋体", Font.BOLD, 40)); + btn_state.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); btn_state.setBounds(995, 241, 280, 505); add(btn_state); btn_state.addActionListener(this); lb_manager = new JLabel("New label"); lb_manager.setHorizontalAlignment(SwingConstants.CENTER); - lb_manager.setFont(new Font("宋体", Font.BOLD, 28)); + lb_manager.setFont(new Font("瀹嬩綋", Font.BOLD, 28)); lb_manager.setBounds(954, 0, 348, 56); add(lb_manager); } - // 设置右上角当前管理员 + // 璁剧疆鍙充笂瑙掑綋鍓嶇鐞嗗憳 public static void setManager() { - lb_manager.setText("当前管理员:" + Information.manager); + lb_manager.setText("褰撳墠绠$悊鍛橈細" + Information.manager); } @Override diff --git a/src/me/xixu/Manager/NewClass.java b/src/me/xixu/Manager/NewClass.java index 8609e15..7a47880 100644 --- a/src/me/xixu/Manager/NewClass.java +++ b/src/me/xixu/Manager/NewClass.java @@ -33,40 +33,40 @@ public class NewClass extends JPanel implements ActionListener { label = new JLabel("\u65B0\u5EFA\u56FE\u4E66\u5E93"); label.setHorizontalAlignment(SwingConstants.CENTER); - label.setFont(new Font("宋体", Font.BOLD, 40)); + label.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); label.setBounds(542, 20, 294, 105); add(label); lb_classnumber = new JLabel("\u5206\u7C7B\u7F16\u53F7\uFF1A"); - lb_classnumber.setFont(new Font("宋体", Font.BOLD, 35)); + lb_classnumber.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_classnumber.setBounds(361, 260, 194, 55); add(lb_classnumber); tf_classnumber = new JTextField(); - tf_classnumber.setFont(new Font("宋体", Font.BOLD, 35)); + tf_classnumber.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_classnumber.setColumns(10); tf_classnumber.setBounds(555, 250, 399, 75); add(tf_classnumber); tf_classname = new JTextField(); - tf_classname.setFont(new Font("宋体", Font.BOLD, 35)); + tf_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_classname.setColumns(10); tf_classname.setBounds(555, 431, 399, 75); add(tf_classname); lb_classname = new JLabel("\u5206\u7C7B\u540D\u79F0\uFF1A"); - lb_classname.setFont(new Font("宋体", Font.BOLD, 35)); + lb_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_classname.setBounds(361, 441, 194, 55); add(lb_classname); btn_submit = new JButton("\u63D0\u4EA4"); - btn_submit.setFont(new Font("宋体", Font.BOLD, 35)); + btn_submit.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); btn_submit.setBounds(585, 637, 251, 80); add(btn_submit); btn_submit.addActionListener(this); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); @@ -76,17 +76,17 @@ public class NewClass extends JPanel implements ActionListener { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == back) { - // 点击返回按钮 + // 鐐瑰嚮杩斿洖鎸夐挳 MainInterface.NewClasstoManager(); } else if (e.getSource() == btn_submit) { - // 点击提交按钮 + // 鐐瑰嚮鎻愪氦鎸夐挳 if (!TableOperate.isExist_Table(tf_classname.getText().toLowerCase() + "book")) { TableOperate.newClass(tf_classnumber.getText(), tf_classname.getText()); tf_classnumber.setText(""); tf_classname.setText(""); - JOptionPane.showMessageDialog(null, "恭喜", "添加新类别成功", JOptionPane.OK_CANCEL_OPTION); + JOptionPane.showMessageDialog(null, "鎭枩", "娣诲姞鏂扮被鍒垚鍔�", JOptionPane.OK_CANCEL_OPTION); } else { - JOptionPane.showMessageDialog(null, "该类别已存在", "添加新类别失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "璇ョ被鍒凡瀛樺湪", "娣诲姞鏂扮被鍒け璐�", JOptionPane.ERROR_MESSAGE); } } diff --git a/src/me/xixu/Manager/State.java b/src/me/xixu/Manager/State.java index 2dbe4ad..db4bcfe 100644 --- a/src/me/xixu/Manager/State.java +++ b/src/me/xixu/Manager/State.java @@ -31,30 +31,30 @@ public class State extends JPanel implements ActionListener { setLayout(null); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); label = new JLabel("\u56FE\u4E66\u5E93\u72B6\u6001\u67E5\u8BE2"); label.setHorizontalAlignment(SwingConstants.CENTER); - label.setFont(new Font("宋体", Font.BOLD, 40)); + label.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); label.setBounds(530, 20, 294, 105); add(label); lb_classname = new JLabel("\u4E66\u5E93\u7C7B\u522B\u540D\u79F0\uFF1A"); - lb_classname.setFont(new Font("宋体", Font.BOLD, 35)); + lb_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_classname.setBounds(241, 330, 283, 55); add(lb_classname); tf_classname = new JTextField(); - tf_classname.setFont(new Font("宋体", Font.BOLD, 35)); + tf_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_classname.setColumns(10); tf_classname.setBounds(502, 320, 526, 75); add(tf_classname); btn_search = new JButton("\u67E5\u8BE2"); - btn_search.setFont(new Font("宋体", Font.BOLD, 35)); + btn_search.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); btn_search.setBounds(558, 567, 251, 80); add(btn_search); btn_search.addActionListener(this); @@ -71,16 +71,16 @@ public class State extends JPanel implements ActionListener { Information.search_classname = classname; - // 查询该类图书信息 - // 判定是否存在查询类别 + // 鏌ヨ璇ョ被鍥句功淇℃伅 + // 鍒ゅ畾鏄惁瀛樺湪鏌ヨ绫诲埆 if (TableOperate.isExist_Table(classname + "book")) { - JOptionPane.showMessageDialog(null, "欢迎", "查询成功", JOptionPane.OK_CANCEL_OPTION); + JOptionPane.showMessageDialog(null, "娆㈣繋", "鏌ヨ鎴愬姛", JOptionPane.OK_CANCEL_OPTION); TableOperate.search_classname(tf_classname.getText()); MainInterface.StatetoStateInfo(); State_Information.setTextArea(); tf_classname.setText(""); } else { - JOptionPane.showMessageDialog(null, "不存在该类别", "查询失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "涓嶅瓨鍦ㄨ绫诲埆", "鏌ヨ澶辫触", JOptionPane.ERROR_MESSAGE); } } } diff --git a/src/me/xixu/Manager/State_Information.java b/src/me/xixu/Manager/State_Information.java index 04dd5a9..2fce0dc 100644 --- a/src/me/xixu/Manager/State_Information.java +++ b/src/me/xixu/Manager/State_Information.java @@ -25,7 +25,7 @@ public class State_Information extends JPanel implements ActionListener { setLayout(null); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); @@ -37,12 +37,12 @@ public class State_Information extends JPanel implements ActionListener { textArea.setEditable(false); - info = "图书编号 分类编号 图书名称 分类名称 价格 状态 获取人 终止日期\n"; + info = "鍥句功缂栧彿 鍒嗙被缂栧彿 鍥句功鍚嶇О 鍒嗙被鍚嶇О 浠锋牸 鐘舵�� 鑾峰彇浜� 缁堟鏃ユ湡\n"; } public static void setTextArea() { - info = "图书编号 分类编号 图书名称 分类名称 价格 状态 获取人 终止日期\n"; + info = "鍥句功缂栧彿 鍒嗙被缂栧彿 鍥句功鍚嶇О 鍒嗙被鍚嶇О 浠锋牸 鐘舵�� 鑾峰彇浜� 缁堟鏃ユ湡\n"; for (int i = 0; i < Information.bookarray.size(); i++) { info = info + " " + Information.bookarray.get(i).number + " "; diff --git a/src/me/xixu/Manager/UpdateBook.java b/src/me/xixu/Manager/UpdateBook.java index 72103e5..39e2d5c 100644 --- a/src/me/xixu/Manager/UpdateBook.java +++ b/src/me/xixu/Manager/UpdateBook.java @@ -46,111 +46,111 @@ public class UpdateBook extends JPanel implements ActionListener { label = new JLabel("\u66F4\u65B0\u56FE\u4E66\u4FE1\u606F"); label.setHorizontalAlignment(SwingConstants.CENTER); - label.setFont(new Font("宋体", Font.BOLD, 40)); + label.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); label.setBounds(530, 20, 294, 105); add(label); lb_old_number = new JLabel("\u65E7\u7F16\u53F7\uFF1A"); - lb_old_number.setFont(new Font("宋体", Font.BOLD, 35)); + lb_old_number.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_old_number.setBounds(165, 127, 194, 55); add(lb_old_number); tf_old_number = new JTextField(); - tf_old_number.setFont(new Font("宋体", Font.BOLD, 35)); + tf_old_number.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_old_number.setColumns(10); tf_old_number.setBounds(298, 117, 252, 75); add(tf_old_number); tf_new_number = new JTextField(); - tf_new_number.setFont(new Font("宋体", Font.BOLD, 35)); + tf_new_number.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_new_number.setColumns(10); tf_new_number.setBounds(507, 274, 526, 75); add(tf_new_number); update = new JLabel("\u66F4\u65B0\u4FE1\u606F"); - update.setFont(new Font("宋体", Font.BOLD, 35)); + update.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); update.setBounds(607, 213, 157, 55); add(update); tf_new_classnumber = new JTextField(); - tf_new_classnumber.setFont(new Font("宋体", Font.BOLD, 35)); + tf_new_classnumber.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_new_classnumber.setColumns(10); tf_new_classnumber.setBounds(507, 370, 526, 75); add(tf_new_classnumber); tf_old_classname = new JTextField(); - tf_old_classname.setFont(new Font("宋体", Font.BOLD, 35)); + tf_old_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_old_classname.setColumns(10); tf_old_classname.setBounds(788, 117, 342, 75); add(tf_old_classname); lb_old_classname = new JLabel("\u65E7\u5206\u7C7B\u540D\u79F0\uFF1A"); - lb_old_classname.setFont(new Font("宋体", Font.BOLD, 35)); + lb_old_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_old_classname.setBounds(570, 127, 222, 55); add(lb_old_classname); tf_new_name = new JTextField(); - tf_new_name.setFont(new Font("宋体", Font.BOLD, 35)); + tf_new_name.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_new_name.setColumns(10); tf_new_name.setBounds(507, 466, 526, 75); add(tf_new_name); tf_new_classname = new JTextField(); - tf_new_classname.setFont(new Font("宋体", Font.BOLD, 35)); + tf_new_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_new_classname.setColumns(10); tf_new_classname.setBounds(507, 562, 526, 75); add(tf_new_classname); tf_new_price = new JTextField(); - tf_new_price.setFont(new Font("宋体", Font.BOLD, 35)); + tf_new_price.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_new_price.setColumns(10); tf_new_price.setBounds(507, 658, 526, 75); add(tf_new_price); tf_new_state = new JTextField(); - tf_new_state.setFont(new Font("宋体", Font.BOLD, 35)); + tf_new_state.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_new_state.setColumns(10); tf_new_state.setBounds(507, 754, 526, 75); add(tf_new_state); lb_new_number = new JLabel("\u65B0\u7F16\u53F7\uFF1A"); - lb_new_number.setFont(new Font("宋体", Font.BOLD, 35)); + lb_new_number.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_new_number.setBounds(285, 284, 194, 55); add(lb_new_number); lb_new_classnumber = new JLabel("\u65B0\u5206\u7C7B\u7F16\u53F7\uFF1A"); - lb_new_classnumber.setFont(new Font("宋体", Font.BOLD, 35)); + lb_new_classnumber.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_new_classnumber.setBounds(285, 380, 227, 55); add(lb_new_classnumber); lb_new_name = new JLabel("\u65B0\u4E66\u540D\uFF1A"); - lb_new_name.setFont(new Font("宋体", Font.BOLD, 35)); + lb_new_name.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_new_name.setBounds(285, 476, 194, 55); add(lb_new_name); lb_new_classname = new JLabel("\u65B0\u5206\u7C7B\u540D\u79F0\uFF1A"); - lb_new_classname.setFont(new Font("宋体", Font.BOLD, 35)); + lb_new_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_new_classname.setBounds(285, 572, 227, 55); add(lb_new_classname); lb_new_price = new JLabel("\u65B0\u4EF7\u683C\uFF1A"); - lb_new_price.setFont(new Font("宋体", Font.BOLD, 35)); + lb_new_price.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_new_price.setBounds(285, 668, 227, 55); add(lb_new_price); lb_new_state = new JLabel("\u65B0\u72B6\u6001\uFF1A"); - lb_new_state.setFont(new Font("宋体", Font.BOLD, 35)); + lb_new_state.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_new_state.setBounds(285, 764, 232, 55); add(lb_new_state); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); btn_submit = new JButton("\u63D0\u4EA4"); - btn_submit.setFont(new Font("宋体", Font.BOLD, 35)); + btn_submit.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); btn_submit.setBounds(570, 850, 251, 80); add(btn_submit); btn_submit.addActionListener(this); @@ -160,14 +160,14 @@ public class UpdateBook extends JPanel implements ActionListener { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == back) { - // 点击返回按钮 + // 鐐瑰嚮杩斿洖鎸夐挳 MainInterface.UpdatetoManager(); } else if (e.getSource() == btn_submit) { - // 点击更新信息提交按钮 - // 旧信息 + // 鐐瑰嚮鏇存柊淇℃伅鎻愪氦鎸夐挳 + // 鏃т俊鎭� String old_number = tf_old_number.getText(); String old_classname = tf_old_classname.getText(); - // 新信息 + // 鏂颁俊鎭� String number = tf_new_number.getText(); String classnumber = tf_new_classnumber.getText(); String name = tf_new_name.getText(); @@ -176,9 +176,9 @@ public class UpdateBook extends JPanel implements ActionListener { String state = tf_new_state.getText(); if (!TableOperate.search_bookstate(old_classname, old_number).equals("null")) { - // 删除旧书籍信息 + // 鍒犻櫎鏃т功绫嶄俊鎭� TableOperate.deleteBook(old_number, old_classname); - // 插入新书籍信息 + // 鎻掑叆鏂颁功绫嶄俊鎭� TableOperate.insertBook(number, classnumber, name, classname, price, state, "1"); tf_old_classname.setText(""); tf_old_number.setText(""); @@ -188,9 +188,9 @@ public class UpdateBook extends JPanel implements ActionListener { tf_new_classname.setText(""); tf_new_price.setText(""); tf_new_state.setText(""); - JOptionPane.showMessageDialog(null, "成功", "更新信息成功", JOptionPane.OK_CANCEL_OPTION); + JOptionPane.showMessageDialog(null, "鎴愬姛", "鏇存柊淇℃伅鎴愬姛", JOptionPane.OK_CANCEL_OPTION); } else { - JOptionPane.showMessageDialog(null, "输入信息有误", "更新信息失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "杈撳叆淇℃伅鏈夎", "鏇存柊淇℃伅澶辫触", JOptionPane.ERROR_MESSAGE); } } } diff --git a/src/me/xixu/Run.java b/src/me/xixu/Run.java index a0c3ac2..2894983 100644 --- a/src/me/xixu/Run.java +++ b/src/me/xixu/Run.java @@ -8,9 +8,9 @@ public class Run { EventQueue.invokeLater(new Runnable() { public void run() { try { - // 实例化主界面 + // 瀹炰緥鍖栦富鐣岄潰 MainInterface frame = new MainInterface(); - // 显示主界面 + // 鏄剧ず涓荤晫闈� frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); diff --git a/src/me/xixu/Static/Information.java b/src/me/xixu/Static/Information.java index 9fbd86d..2f3e9e8 100644 --- a/src/me/xixu/Static/Information.java +++ b/src/me/xixu/Static/Information.java @@ -6,21 +6,21 @@ import me.xixu.Book; public class Information { - // 数据库用户名 + // 鏁版嵁搴撶敤鎴峰悕 public static String username = "root"; - // 数据库密码 + // 鏁版嵁搴撳瘑鐮� public static String password = "root"; - // 数据库URL地址 + // 鏁版嵁搴揢RL鍦板潃 public static String JDBC_URL = "jdbc:mysql://localhost:3306/BookManageSYS"; - // 查询数据库图书类别名称 + // 鏌ヨ鏁版嵁搴撳浘涔︾被鍒悕绉� public static String search_classname = ""; - // 查询数据库图书列表 + // 鏌ヨ鏁版嵁搴撳浘涔﹀垪琛� public static ArrayList bookarray = new ArrayList(); - // 当前管理员 + // 褰撳墠绠$悊鍛� public static String manager = ""; - // 当前用户 + // 褰撳墠鐢ㄦ埛 public static String user = ""; - // 查询Table列表 + // 鏌ヨTable鍒楄〃 public static ArrayList tablearray = new ArrayList(); } diff --git a/src/me/xixu/User/BorrowBook.java b/src/me/xixu/User/BorrowBook.java index 556e4ba..e5b94ca 100644 --- a/src/me/xixu/User/BorrowBook.java +++ b/src/me/xixu/User/BorrowBook.java @@ -31,30 +31,30 @@ public class BorrowBook extends JPanel implements ActionListener { setLayout(null); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); label = new JLabel("\u501F\u4E66\u7CFB\u7EDF"); label.setHorizontalAlignment(SwingConstants.CENTER); - label.setFont(new Font("宋体", Font.BOLD, 40)); + label.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); label.setBounds(530, 62, 294, 105); add(label); lb_classname = new JLabel("\u4E66\u5E93\u7C7B\u522B\u540D\u79F0\uFF1A"); - lb_classname.setFont(new Font("宋体", Font.BOLD, 35)); + lb_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_classname.setBounds(241, 330, 283, 55); add(lb_classname); tf_classname = new JTextField(); - tf_classname.setFont(new Font("宋体", Font.BOLD, 35)); + tf_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_classname.setColumns(10); tf_classname.setBounds(502, 320, 526, 75); add(tf_classname); btn_search = new JButton("\u67E5\u8BE2"); - btn_search.setFont(new Font("宋体", Font.BOLD, 35)); + btn_search.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); btn_search.setBounds(558, 567, 251, 80); add(btn_search); btn_search.addActionListener(this); @@ -70,14 +70,14 @@ public class BorrowBook extends JPanel implements ActionListener { String classname = tf_classname.getText(); Information.search_classname = classname; - // 查询该类图书信息 + // 鏌ヨ璇ョ被鍥句功淇℃伅 if (TableOperate.isExist_Table(classname + "book")) { TableOperate.search_classname(tf_classname.getText()); MainInterface.BorrowtoBorrowInfo(); BorrowBook_Information.setTextArea(); tf_classname.setText(""); } else { - JOptionPane.showMessageDialog(null, "不存在该类别", "查询失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "涓嶅瓨鍦ㄨ绫诲埆", "鏌ヨ澶辫触", JOptionPane.ERROR_MESSAGE); } } } diff --git a/src/me/xixu/User/BorrowBook_Information.java b/src/me/xixu/User/BorrowBook_Information.java index 07ff9e1..b2336d4 100644 --- a/src/me/xixu/User/BorrowBook_Information.java +++ b/src/me/xixu/User/BorrowBook_Information.java @@ -34,7 +34,7 @@ public class BorrowBook_Information extends JPanel implements ActionListener { setLayout(null); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); @@ -47,39 +47,39 @@ public class BorrowBook_Information extends JPanel implements ActionListener { textArea.setEditable(false); lb_number = new JLabel("\u56FE\u4E66\u7F16\u53F7\uFF1A"); - lb_number.setFont(new Font("宋体", Font.BOLD, 35)); + lb_number.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_number.setBounds(152, 39, 185, 55); add(lb_number); tf_number = new JTextField(); - tf_number.setFont(new Font("宋体", Font.BOLD, 35)); + tf_number.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_number.setColumns(10); tf_number.setBounds(317, 29, 226, 75); add(tf_number); btn_borrow = new JButton("\u501F\u4E66"); - btn_borrow.setFont(new Font("宋体", Font.BOLD, 35)); + btn_borrow.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); btn_borrow.setBounds(926, 26, 251, 80); add(btn_borrow); btn_borrow.addActionListener(this); lb_dateoff = new JLabel("\u671F\u9650\uFF1A"); - lb_dateoff.setFont(new Font("宋体", Font.BOLD, 35)); + lb_dateoff.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_dateoff.setBounds(575, 39, 185, 55); add(lb_dateoff); tf_dateoff = new JTextField(); - tf_dateoff.setFont(new Font("宋体", Font.BOLD, 35)); + tf_dateoff.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_dateoff.setColumns(10); tf_dateoff.setBounds(679, 29, 226, 75); add(tf_dateoff); - info = "图书编号 分类编号 图书名称 分类名称 价格 状态 获取人 终止日期\n"; + info = "鍥句功缂栧彿 鍒嗙被缂栧彿 鍥句功鍚嶇О 鍒嗙被鍚嶇О 浠锋牸 鐘舵�� 鑾峰彇浜� 缁堟鏃ユ湡\n"; } public static void setTextArea() { - info = "图书编号 分类编号 图书名称 分类名称 价格 状态 获取人 终止日期\n"; + info = "鍥句功缂栧彿 鍒嗙被缂栧彿 鍥句功鍚嶇О 鍒嗙被鍚嶇О 浠锋牸 鐘舵�� 鑾峰彇浜� 缁堟鏃ユ湡\n"; for (int i = 0; i < Information.bookarray.size(); i++) { info = info + " " + Information.bookarray.get(i).number + " "; @@ -107,18 +107,18 @@ public class BorrowBook_Information extends JPanel implements ActionListener { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == back) { - // 点击返回按钮 + // 鐐瑰嚮杩斿洖鎸夐挳 MainInterface.BorrowInfotoBorrow(); } if (e.getSource() == btn_borrow) { - // 点击借书按钮 - // 先判定是否有此书 + // 鐐瑰嚮鍊熶功鎸夐挳 + // 鍏堝垽瀹氭槸鍚︽湁姝や功 if (TableOperate.search_bookname(Information.search_classname, tf_number.getText()).equals("null")) { - JOptionPane.showMessageDialog(null, "输入借书信息有误", "借书失败", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, "杈撳叆鍊熶功淇℃伅鏈夎", "鍊熶功澶辫触", JOptionPane.ERROR_MESSAGE); tf_number.setText(""); tf_dateoff.setText(""); } else { - // 判定此书是否已被借出 + // 鍒ゅ畾姝や功鏄惁宸茶鍊熷嚭 if (TableOperate.search_bookstate(Information.search_classname, tf_number.getText()).equals("in")) { TableOperate.borrowBook_Update(Information.search_classname, tf_number.getText(), Information.user, tf_dateoff.getText().toString()); @@ -129,9 +129,9 @@ public class BorrowBook_Information extends JPanel implements ActionListener { MainInterface.BorrowInfotoBorrow(); MainInterface.BorrowtoUser(); } else { - JOptionPane.showMessageDialog(null, "该书已借出至:" + JOptionPane.showMessageDialog(null, "璇ヤ功宸插�熷嚭鑷筹細" + TableOperate.search_bookdateoff(Information.search_classname, tf_number.getText()), - "借书失败", JOptionPane.ERROR_MESSAGE); + "鍊熶功澶辫触", JOptionPane.ERROR_MESSAGE); tf_number.setText(""); tf_dateoff.setText(""); } diff --git a/src/me/xixu/User/PersonalInformation.java b/src/me/xixu/User/PersonalInformation.java index fc32ffd..00b6efb 100644 --- a/src/me/xixu/User/PersonalInformation.java +++ b/src/me/xixu/User/PersonalInformation.java @@ -28,14 +28,14 @@ public class PersonalInformation extends JPanel implements ActionListener { setLayout(null); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); label = new JLabel("\u4E2A\u4EBA\u4FE1\u606F"); label.setHorizontalAlignment(SwingConstants.CENTER); - label.setFont(new Font("宋体", Font.BOLD, 40)); + label.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); label.setBounds(530, 20, 294, 105); add(label); @@ -45,12 +45,12 @@ public class PersonalInformation extends JPanel implements ActionListener { textArea.setBounds(111, 125, 1050, 782); add(textArea); - info = "图书编号 分类名称 图书名称 还书期限\n"; + info = "鍥句功缂栧彿 鍒嗙被鍚嶇О 鍥句功鍚嶇О 杩樹功鏈熼檺\n"; } public static void setTextArea() { - info = "图书编号 分类名称 图书名称 还书期限\n"; + info = "鍥句功缂栧彿 鍒嗙被鍚嶇О 鍥句功鍚嶇О 杩樹功鏈熼檺\n"; for (int i = 0; i < Information.bookarray.size(); i++) { info = info + " " + Information.bookarray.get(i).number + " "; diff --git a/src/me/xixu/User/ProlongBook.java b/src/me/xixu/User/ProlongBook.java index 2d77a62..a4baf5d 100644 --- a/src/me/xixu/User/ProlongBook.java +++ b/src/me/xixu/User/ProlongBook.java @@ -33,52 +33,52 @@ public class ProlongBook extends JPanel implements ActionListener { setLayout(null); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); JLabel label = new JLabel("\u7EED\u501F\u7CFB\u7EDF"); label.setHorizontalAlignment(SwingConstants.CENTER); - label.setFont(new Font("宋体", Font.BOLD, 40)); + label.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); label.setBounds(530, 20, 294, 105); add(label); lb_classname = new JLabel("\u4E66\u5E93\u7C7B\u522B\u540D\u79F0\uFF1A"); - lb_classname.setFont(new Font("宋体", Font.BOLD, 35)); + lb_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_classname.setBounds(281, 216, 283, 55); add(lb_classname); tf_classname = new JTextField(); - tf_classname.setFont(new Font("宋体", Font.BOLD, 35)); + tf_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_classname.setColumns(10); tf_classname.setBounds(554, 206, 526, 75); add(tf_classname); lb_number = new JLabel("\u4E66\u7C4D\u7F16\u53F7\uFF1A"); - lb_number.setFont(new Font("宋体", Font.BOLD, 35)); + lb_number.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_number.setBounds(281, 360, 283, 55); add(lb_number); lb_dateoff = new JLabel("\u7EED\u501F\u671F\u9650\uFF1A"); - lb_dateoff.setFont(new Font("宋体", Font.BOLD, 35)); + lb_dateoff.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_dateoff.setBounds(281, 498, 283, 55); add(lb_dateoff); tf_number = new JTextField(); - tf_number.setFont(new Font("宋体", Font.BOLD, 35)); + tf_number.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_number.setColumns(10); tf_number.setBounds(554, 350, 526, 75); add(tf_number); tf_dateoff = new JTextField(); - tf_dateoff.setFont(new Font("宋体", Font.BOLD, 35)); + tf_dateoff.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_dateoff.setColumns(10); tf_dateoff.setBounds(554, 488, 526, 75); add(tf_dateoff); btn_prolong = new JButton("\u7EED\u501F"); - btn_prolong.setFont(new Font("宋体", Font.BOLD, 35)); + btn_prolong.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); btn_prolong.setBounds(554, 661, 251, 80); add(btn_prolong); btn_prolong.addActionListener(this); @@ -87,7 +87,7 @@ public class ProlongBook extends JPanel implements ActionListener { @Override public void actionPerformed(ActionEvent e) { - // + // if (e.getSource() == back) { MainInterface.ProlongtoUser(); } else if (e.getSource() == btn_prolong) { diff --git a/src/me/xixu/User/ReturnBook.java b/src/me/xixu/User/ReturnBook.java index 09745ec..59328c7 100644 --- a/src/me/xixu/User/ReturnBook.java +++ b/src/me/xixu/User/ReturnBook.java @@ -35,52 +35,52 @@ public class ReturnBook extends JPanel implements ActionListener { setLayout(null); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); label = new JLabel("\u8FD8\u4E66\u7CFB\u7EDF"); label.setHorizontalAlignment(SwingConstants.CENTER); - label.setFont(new Font("宋体", Font.BOLD, 40)); + label.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); label.setBounds(529, 69, 294, 105); add(label); lb_classname = new JLabel("\u4E66\u5E93\u7C7B\u522B\u540D\u79F0\uFF1A"); - lb_classname.setFont(new Font("宋体", Font.BOLD, 35)); + lb_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_classname.setBounds(240, 302, 283, 55); add(lb_classname); tf_classname = new JTextField(); - tf_classname.setFont(new Font("宋体", Font.BOLD, 35)); + tf_classname.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_classname.setColumns(10); tf_classname.setBounds(503, 292, 526, 75); add(tf_classname); btn_return = new JButton("\u5F52\u8FD8"); - btn_return.setFont(new Font("宋体", Font.BOLD, 35)); + btn_return.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); btn_return.setBounds(557, 764, 251, 80); add(btn_return); btn_return.addActionListener(this); lb_classnumber = new JLabel("\u56FE\u4E66\u7F16\u53F7\uFF1A"); - lb_classnumber.setFont(new Font("宋体", Font.BOLD, 35)); + lb_classnumber.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_classnumber.setBounds(240, 454, 283, 55); add(lb_classnumber); tf_number = new JTextField(); - tf_number.setFont(new Font("宋体", Font.BOLD, 35)); + tf_number.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_number.setColumns(10); tf_number.setBounds(503, 444, 526, 75); add(tf_number); lb_today = new JLabel("\u8FD8\u4E66\u65E5\u671F\uFF1A"); - lb_today.setFont(new Font("宋体", Font.BOLD, 35)); + lb_today.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); lb_today.setBounds(240, 590, 283, 55); add(lb_today); tf_today = new JTextField(); - tf_today.setFont(new Font("宋体", Font.BOLD, 35)); + tf_today.setFont(new Font("瀹嬩綋", Font.BOLD, 35)); tf_today.setColumns(10); tf_today.setBounds(503, 580, 526, 75); add(tf_today); @@ -98,7 +98,7 @@ public class ReturnBook extends JPanel implements ActionListener { String today = tf_today.getText(); if (TableOperate.search_bookdateoff(classname, number) < Integer.parseInt(today)) { - JOptionPane.showMessageDialog(null, "谢谢合作", "请去缴纳罚款", JOptionPane.OK_CANCEL_OPTION); + JOptionPane.showMessageDialog(null, "璋㈣阿鍚堜綔", "璇峰幓缂寸撼缃氭", JOptionPane.OK_CANCEL_OPTION); } TableOperate.returnBook_Update(classname, number, Information.user, today); diff --git a/src/me/xixu/User/UserInterface.java b/src/me/xixu/User/UserInterface.java index d03b7ba..5c51dc7 100644 --- a/src/me/xixu/User/UserInterface.java +++ b/src/me/xixu/User/UserInterface.java @@ -31,43 +31,43 @@ public class UserInterface extends JPanel implements ActionListener { setLayout(null); back = new JButton("\u8FD4\u56DE"); - back.setFont(new Font("宋体", Font.PLAIN, 26)); + back.setFont(new Font("瀹嬩綋", Font.PLAIN, 26)); back.setBounds(0, 0, 115, 82); add(back); back.addActionListener(this); label = new JLabel("\u7528\u6237\u754C\u9762"); label.setHorizontalAlignment(SwingConstants.CENTER); - label.setFont(new Font("宋体", Font.BOLD, 40)); + label.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); label.setBounds(512, 47, 294, 105); add(label); lb_user = new JLabel("New label"); lb_user.setHorizontalAlignment(SwingConstants.CENTER); - lb_user.setFont(new Font("宋体", Font.BOLD, 28)); + lb_user.setFont(new Font("瀹嬩綋", Font.BOLD, 28)); lb_user.setBounds(944, 0, 356, 56); add(lb_user); btn_borrow = new JButton("\u501F\u4E66"); - btn_borrow.setFont(new Font("宋体", Font.BOLD, 40)); + btn_borrow.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); btn_borrow.setBounds(31, 233, 280, 505); add(btn_borrow); btn_borrow.addActionListener(this); btn_return = new JButton("\u8FD8\u4E66"); - btn_return.setFont(new Font("宋体", Font.BOLD, 40)); + btn_return.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); btn_return.setBounds(351, 233, 280, 505); add(btn_return); btn_return.addActionListener(this); btn_prolong = new JButton("\u7EED\u501F"); - btn_prolong.setFont(new Font("宋体", Font.BOLD, 40)); + btn_prolong.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); btn_prolong.setBounds(674, 233, 280, 505); add(btn_prolong); btn_prolong.addActionListener(this); btn_personal = new JButton("\u4E2A\u4EBA\u4FE1\u606F"); - btn_personal.setFont(new Font("宋体", Font.BOLD, 40)); + btn_personal.setFont(new Font("瀹嬩綋", Font.BOLD, 40)); btn_personal.setBounds(999, 233, 280, 505); add(btn_personal); btn_personal.addActionListener(this); @@ -75,7 +75,7 @@ public class UserInterface extends JPanel implements ActionListener { } public static void setUser() { - lb_user.setText("当前用户:" + Information.user); + lb_user.setText("褰撳墠鐢ㄦ埛锛�" + Information.user); } @Override