From c1ac7b8d9a36a53283cdf1aa268ac7314c51ce01 Mon Sep 17 00:00:00 2001 From: 50582 <505822174@qq.com> Date: Wed, 4 Dec 2019 19:33:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E7=AB=8B=E4=BA=86=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=96=87=E4=BB=B6=E5=A4=B9=E6=9D=A5=E5=82=A8?= =?UTF-8?q?=E5=AD=98=E6=B3=A8=E5=86=8C=E9=A1=B5=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fxml/CreateAccount.fxml | 2 +- src/fxml/CreateSuccessfully.fxml | 2 +- src/fxml/Login.fxml | 2 +- src/fxml/WrongPassword.fxml | 2 +- src/imgzip/Login_SignIn/CreateAccount.java | 61 ++++ .../Login_SignIn/CreateAccountController.java | 286 ++++++++++++++++++ .../CreateSuccessfullyController.java | 39 +++ .../Login_SignIn/DataBaseController.java | 96 ++++++ src/imgzip/Login_SignIn/Login.java | 156 ++++++++++ src/imgzip/Login_SignIn/LoginController.java | 189 ++++++++++++ src/imgzip/Login_SignIn/WrongPassword.java | 30 ++ .../Login_SignIn/WrongPasswordController.java | 61 ++++ 12 files changed, 922 insertions(+), 4 deletions(-) create mode 100644 src/imgzip/Login_SignIn/CreateAccount.java create mode 100644 src/imgzip/Login_SignIn/CreateAccountController.java create mode 100644 src/imgzip/Login_SignIn/CreateSuccessfullyController.java create mode 100644 src/imgzip/Login_SignIn/DataBaseController.java create mode 100644 src/imgzip/Login_SignIn/Login.java create mode 100644 src/imgzip/Login_SignIn/LoginController.java create mode 100644 src/imgzip/Login_SignIn/WrongPassword.java create mode 100644 src/imgzip/Login_SignIn/WrongPasswordController.java diff --git a/src/fxml/CreateAccount.fxml b/src/fxml/CreateAccount.fxml index d700dd5..5a6861e 100644 --- a/src/fxml/CreateAccount.fxml +++ b/src/fxml/CreateAccount.fxml @@ -10,7 +10,7 @@ - + diff --git a/src/fxml/CreateSuccessfully.fxml b/src/fxml/CreateSuccessfully.fxml index ee7696f..32d2db7 100644 --- a/src/fxml/CreateSuccessfully.fxml +++ b/src/fxml/CreateSuccessfully.fxml @@ -9,7 +9,7 @@ - + diff --git a/src/fxml/Login.fxml b/src/fxml/Login.fxml index 3eb3b86..12e866e 100644 --- a/src/fxml/Login.fxml +++ b/src/fxml/Login.fxml @@ -8,7 +8,7 @@ - + diff --git a/src/fxml/WrongPassword.fxml b/src/fxml/WrongPassword.fxml index 52e84ab..0b3e4c0 100644 --- a/src/fxml/WrongPassword.fxml +++ b/src/fxml/WrongPassword.fxml @@ -9,7 +9,7 @@ - + diff --git a/src/imgzip/Login_SignIn/CreateAccount.java b/src/imgzip/Login_SignIn/CreateAccount.java new file mode 100644 index 0000000..8ed9c3c --- /dev/null +++ b/src/imgzip/Login_SignIn/CreateAccount.java @@ -0,0 +1,61 @@ +package imgzip.Login_SignIn; + +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.stage.Stage; + +import javafx.scene.control.Label; + +/** + @Author: 肖尧 + @Date: 2019.12.4 + */ +public class CreateAccount { + public CreateAccount(){ + try { + Parent root = FXMLLoader.load(getClass().getResource("/fxml/CreateAccount.fxml")); + + Label already = (Label)root.lookup("#Al"); + already.setVisible(false); + + Label already2 = (Label)root.lookup("#Al2"); + already2.setVisible(false); + + Button createAccount = (Button)root.lookup("#createAccount"); + createAccount.setDisable(true); + + Stage primaryStage = new Stage(); + primaryStage.setTitle("Create an Account"); + primaryStage.setScene(new Scene(root, 600.0000999999975, 633)); + primaryStage.show(); + + }catch (Exception e){ + e.printStackTrace(); + } + + } +} + +class CreateSuccessfully{ + + public CreateSuccessfully(){ + + try { + Parent root = FXMLLoader.load(getClass().getResource("/fxml/CreateSuccessfully.fxml")); + + Stage primaryStage = new Stage(); + primaryStage.setTitle("Create an Account Successfully!"); + primaryStage.setScene(new Scene(root, 638, 406)); + primaryStage.show(); + + }catch (Exception e){ + e.printStackTrace(); + } + + + } + +} + diff --git a/src/imgzip/Login_SignIn/CreateAccountController.java b/src/imgzip/Login_SignIn/CreateAccountController.java new file mode 100644 index 0000000..5268da6 --- /dev/null +++ b/src/imgzip/Login_SignIn/CreateAccountController.java @@ -0,0 +1,286 @@ +package imgzip.Login_SignIn; +import javafx.application.Platform; +import javafx.fxml.FXML; +import javafx.scene.control.*; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.control.Alert; +import javafx.scene.web.WebEngine; +import javafx.scene.web.WebView; +import javafx.stage.Stage; + +import java.awt.*; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + @Author: 肖尧 + @Date: 2019.12.4 + */ +public class CreateAccountController { + + @FXML + private TextField userName; + + @FXML + private TextField passWord; + + @FXML + private TextField email; + + @FXML + private TextField telephone; + + @FXML + private CheckBox agree; + + @FXML + private Button createAccount; + + @FXML + private Hyperlink privacy; + + @FXML + private Label already; + + @FXML + private Label already2; + + @FXML + private Hyperlink signIn; + + + /** + * SignIn点击后,返回登录页面并关闭注册页面 + */ + public void backToLogin() { + Stage stage = (Stage) signIn.getScene().getWindow(); + new Loginbeginner(); + stage.close(); + + } + + /** + * 检查账号是否存在,如果存在则无法点击注册按钮,且会提醒用户。 + */ + boolean judgeAccountExists = false; + public void checkAccountExistence() { + DataBaseController createAccountInstruction = new DataBaseController(); + ResultSet rs = null; + ResultSet rs2 = null; + + try { + /** + 第一步,检查数据库中是否有该账号存在 + */ + String currentInstruction = "SELECT pwd FROM login WHERE userName=" + "'" + userName.getText().trim() + "'"; + rs = createAccountInstruction.queryExcecute(currentInstruction); + + /** + * 第二步: + * ①如果账号为空,则无法点击注册按钮。 + * ②如果账号存在,无法点击。 + * ③如果账号不存在,邮箱存在,无法点击。 + * ④如果账号邮箱都不存在,但是未同意服务条款,无法点击。 + * ⑤如果账号邮箱都不存在,且同意了服务条款,才可被点击。 + */ + + if("".equals(userName.getText())){ + createAccount.setDisable(true); + + }else { + if (rs.next()) { + judgeAccountExists = true; + already.setVisible(true); + + if(!createAccount.isDisable()){ + createAccount.setDisable(true); + + } + }else{ + judgeAccountExists = false; + already.setVisible(false); + + if(!judgeEmialexist && agree.isSelected()){ + createAccount.setDisable(false); + + } + + } + + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + createAccountInstruction.close(); + } + + } + + /** + * 检查邮箱是否存在,如果存在则无法点击注册按钮,且会提醒用户。 + */ + + boolean judgeEmialexist = false; + public void checkEmailExistence() { + + DataBaseController createAccountInstruction = new DataBaseController(); + ResultSet rs = null; + ResultSet rs2 = null; + + try { + String currentInstruction2 = "SELECT pwd FROM login WHERE email=" + "'" + email.getText().trim() + "'"; + rs2 = createAccountInstruction.queryExcecute(currentInstruction2); + + /** + * 第二步: + * ①如果账号为空,则无法点击注册按钮。 + * ②如果账号存在,无法点击。 + * ③如果账号不存在,邮箱存在,无法点击。 + * ④如果账号邮箱都不存在,但是未同意服务条款,无法点击。 + * ⑤如果账号邮箱都不存在,且同意了服务条款,才可被点击。 + */ + + if ("".equals(email.getText())){ + createAccount.setDisable(true); + + }else { + if (rs2.next()) { + judgeEmialexist = true; + already2.setVisible(true); + + if(!createAccount.isDisable()){ + createAccount.setDisable(true); + + } + }else{ + judgeEmialexist = false; + already2.setVisible(false); + + if(!judgeAccountExists && agree.isSelected()){ + createAccount.setDisable(false); + + } + + } + + } + } catch (Exception e) { + e.printStackTrace(); + + } finally { + createAccountInstruction.close(); + + } + + } + + /** + * CreateAccount点击后,将账号插入数据库中 + */ + public void createAccount() { + DataBaseController createAccountInstruction = new DataBaseController(); + ResultSet rs = null; + + try { + /** + 向数据库中插入数据 + */ + String currentInstruction = "INSERT INTO login (userName,pwd,email,tel) values(" + "'"+userName.getText().trim()+ "'" + "," + "'"+ passWord.getText().trim()+ "'" + "," + "'"+ email.getText().trim() + "'"+ "," + "'"+telephone.getText().trim()+ "'"+")" ; + createAccountInstruction.queryUpdate(currentInstruction); + + /** + 检查数据库中是否成功插入数据 + */ + String currentInstruction2 = "SELECT pwd FROM login WHERE userName=" + "'" + userName.getText().trim() + "'"; + rs = createAccountInstruction.queryExcecute(currentInstruction2); + + if(rs.next()){ + Stage stage = (Stage) signIn.getScene().getWindow(); + new CreateSuccessfully(); + stage.close(); + + }else{ + Alert alert = new Alert(Alert.AlertType.ERROR); + alert.setTitle("SORRY!"); + alert.setHeaderText("Something's wrong!"); + alert.setContentText("The Account is not created"); + alert.showAndWait(); + + } + + } catch (Exception e) { + e.printStackTrace(); + System.out.println("456"); + + } finally { + createAccountInstruction.close(); + + } + + } + + /** + * 检查是否点击了同意privacy协议,如果不同意,则无法点击 createaccount 按钮。 + */ + public void checkIfSelectedPrivacy(){ + if(!judgeAccountExists && !judgeEmialexist && createAccount.isDisable()){ + createAccount.setDisable(false); + + } + + boolean userNmae = "".equals(userName.getText()); + boolean emial = "".equals(email.getText()); + + if(!agree.isSelected() || userNmae || emial ){ + createAccount.setDisable(true); + + } + } + + /** + * 点击Privacy 的 hyperlink后,跳出网页进入隐私条例说明。 + */ + public void openPrivacy(){ + + try{ + try { + Desktop.getDesktop().browse(new URI("https://www.epicgames.com/site/en-US/privacypolicy?lang=en-US&sessionInvalidated=true")); + + }catch (IOException e){ + System.out.println("123"); + + } + }catch (URISyntaxException e){ + System.out.println("456"); + + } + } + + + /** + * 点击Service 的 hyperlink后,跳出网页进入服务说明。 + */ + public void openService(){ + + try{ + try { + Desktop.getDesktop().browse(new URI("https://www.epicgames.com/site/en-US/tos?lang=en-US")); + + }catch (IOException e){ + System.out.println("123"); + + } + }catch (URISyntaxException e){ + System.out.println("456"); + + } + } + +} + + diff --git a/src/imgzip/Login_SignIn/CreateSuccessfullyController.java b/src/imgzip/Login_SignIn/CreateSuccessfullyController.java new file mode 100644 index 0000000..1b8cf0c --- /dev/null +++ b/src/imgzip/Login_SignIn/CreateSuccessfullyController.java @@ -0,0 +1,39 @@ +package imgzip.Login_SignIn; + +import javafx.fxml.FXML; +import javafx.scene.control.Button; +import javafx.stage.Stage; +/** + @Author: 肖尧 + @Date: 2019.11.24 + */ + +public class CreateSuccessfullyController{ + @FXML + private Button signUp; + + @FXML + private Button signIn; + + + /** + * 点击后sign up 后回到登录页面。 + */ + public void backToLogin() { + Stage stage = (Stage) signUp.getScene().getWindow(); + new Loginbeginner(); + stage.close(); + + } + + + /** + * 点击后sign in again 后继续注册。 + */ + public void backToSignIn() { + Stage stage = (Stage) signIn.getScene().getWindow(); + new CreateAccount(); + stage.close(); + + } +} diff --git a/src/imgzip/Login_SignIn/DataBaseController.java b/src/imgzip/Login_SignIn/DataBaseController.java new file mode 100644 index 0000000..bee9798 --- /dev/null +++ b/src/imgzip/Login_SignIn/DataBaseController.java @@ -0,0 +1,96 @@ +package imgzip.Login_SignIn; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; + +public class DataBaseController { + + PreparedStatement ps = null; + Connection ct = null; + ResultSet rs = null; + String url = "jdbc:mysql://120.78.208.4/javaProgrem";//待定调整 + String user = "javaP" ;//待定调整 + String password = "1801090042"; //待定调整 + String driver = "com.mysql.cj.jdbc.Driver"; + + + //关闭资源 + public void close(){ + + try{ + + if(rs != null) { + rs.close(); + } + if (ps != null) { + ps.close(); + } + if (ct != null) { + ct.close(); + + } + + }catch (Exception ex){ + ex.printStackTrace(); + } + } + + public void jdbcConnection(){ + try { + + Class.forName(driver).newInstance(); + ct = DriverManager.getConnection(url,user,password); + System.out.println("连接成功"); + }catch (Exception ex){ + System.out.println("连接失败"); + ex.printStackTrace(); + + } + + } + + + //执行某个查询方法 + public ResultSet queryExcecute(String sql){ + + try { + + Class.forName(driver); + + ct = DriverManager.getConnection(url,user,password); + + ps = ct.prepareStatement(sql); + + rs = ps.executeQuery(); + + }catch (Exception ex){ + ex.printStackTrace(); + + } + + return rs; + } + + + public void queryUpdate(String sql){ + try { + + Class.forName(driver); + + ct = DriverManager.getConnection(url,user,password); + + ps = ct.prepareStatement(sql); + + ps.executeUpdate(); + + }catch (Exception ex){ + ex.printStackTrace(); + + } + + } + + +} diff --git a/src/imgzip/Login_SignIn/Login.java b/src/imgzip/Login_SignIn/Login.java new file mode 100644 index 0000000..6037e20 --- /dev/null +++ b/src/imgzip/Login_SignIn/Login.java @@ -0,0 +1,156 @@ +package imgzip.Login_SignIn; + +import javafx.application.Application; +import javafx.application.Platform; +import javafx.beans.InvalidationListener; +import javafx.beans.Observable; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; +import javafx.scene.control.TextField; +import javafx.scene.control.PasswordField; +import javafx.scene.layout.BorderPane; +import javafx.stage.Stage; + +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileReader; +import java.io.FileWriter; + +/** + @Author: 肖尧 + @Date: 2019.12.4 + */ +public class Login extends Application { + + @Override + public void start(Stage primaryStage) throws Exception{ + + try { + + Parent root = FXMLLoader.load(getClass().getResource("/fxml/Login.fxml")); + + TextField account = (TextField)root.lookup("#Account"); + PasswordField password = (PasswordField)root.lookup("#password"); + CheckBox remember = (CheckBox)root.lookup("#remember"); + Button logIn = (Button)root.lookup("#Login"); + + + /** + 在页面开启之前检查上一次登录时是否记住了密码, + 如果上一次登录点击了记住密码,则在本次打开时会将账号和密码写入 + */ + try { + + FileReader fr = new FileReader("src/txtFile/RememberAccount&Password.txt"); + BufferedReader br = new BufferedReader(fr); + + String line = ""; + line = br.readLine(); + + + String[] judge = line.split("\\|"); + String truejudge = "true"; + int accountIndex = 0; + int passwordIndex = 1; + int judgeIndex = 2; + + if(judge[judgeIndex].equals(truejudge) ){ + account.setText(judge[accountIndex]); + password.appendText(judge[passwordIndex]); + + remember.setSelected(true); + logIn.setDisable(false); + + } + + br.close(); + fr.close(); + + }catch (Exception e){ + e.printStackTrace(); + + } + + primaryStage.setTitle("XXX login"); + primaryStage.setScene(new Scene(root, 638, 400)); + primaryStage.show(); + + }catch (Exception e){ + e.printStackTrace(); + + } + + } + + public static void main(String[] args) { + launch(args); + } + +} + + +class Loginbeginner{ + public Loginbeginner(){ + try { + Stage primaryStage = new Stage(); + Parent root = FXMLLoader.load(getClass().getResource("/fxml/Login.fxml")); + + TextField account = (TextField)root.lookup("#Account"); + PasswordField password = (PasswordField)root.lookup("#password"); + CheckBox remember = (CheckBox)root.lookup("#remember"); + Button logIn = (Button)root.lookup("#Login"); + + + /** + 在页面开启之前检查上一次登录时是否记住了密码, + 如果上一次登录点击了记住密码,则在本次打开时会将账号和密码写入 + */ + try { + + FileReader fr = new FileReader("src/txtFile/RememberAccount&Password.txt"); + BufferedReader br = new BufferedReader(fr); + + String line = ""; + line = br.readLine(); + + + String[] judge = line.split("\\|"); + String truejudge = "true"; + int accountIndex = 0; + int passwordIndex = 1; + int judgeIndex = 2; + + if(judge[judgeIndex].equals(truejudge) ){ + account.setText(judge[accountIndex]); + password.appendText(judge[passwordIndex]); + + remember.setSelected(true); + logIn.setDisable(false); + + } + + br.close(); + fr.close(); + + }catch (Exception e){ + e.printStackTrace(); + + } + + primaryStage.setTitle("XXX login"); + primaryStage.setScene(new Scene(root, 638, 400)); + primaryStage.show(); + + }catch (Exception e){ + e.printStackTrace(); + + } + + } + +} \ No newline at end of file diff --git a/src/imgzip/Login_SignIn/LoginController.java b/src/imgzip/Login_SignIn/LoginController.java new file mode 100644 index 0000000..3e36786 --- /dev/null +++ b/src/imgzip/Login_SignIn/LoginController.java @@ -0,0 +1,189 @@ +package imgzip.Login_SignIn; + +import javafx.application.Platform; +import javafx.fxml.FXML; +import javafx.scene.control.Alert; +import javafx.scene.control.Button; +import javafx.scene.control.TextField; +import javafx.scene.control.CheckBox; +import javafx.stage.Stage; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.FileReader; +import java.io.FileWriter; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; + +import java.sql.SQLException; +import java.sql.Statement; + + +/** + @Author:肖尧 + @Date:2019.11.24 + */ +public class LoginController { + + + @FXML + private TextField account; + + @FXML + private TextField password; + + @FXML + private CheckBox remember; + + @FXML + private Button login; + + @FXML + private Button cancel; + + @FXML + private Button cantSign; + + @FXML + private Button createAccount; + + + + /** + 检查用户是否输入了用户名和密码, + 如果只输入了用户名,或只输入了密码,或两者都没输入,则按钮LOGIN无法被点击, + 当用户名与密码同时被输入时,按钮LOGIN才能被点击。 + */ + public void check(){ + + String stringAccount = account.getText(); + String stringPassword = password.getText(); + String ifEmpty = ""; + + if ( (stringAccount.equals(ifEmpty) || stringPassword.equals(ifEmpty))){ + login.setDisable(true); + + }else if ((!stringAccount.equals(ifEmpty) && !stringPassword.equals(ifEmpty))){ + login.setDisable(false); + } + } + + + /** + 检查是否已经连上数据库 + */ + + public void dataBaseConnectionCheck(){ + DataBaseController loginInstruction = new DataBaseController(); + try { + loginInstruction.jdbcConnection(); + }catch (Exception ex){ + ex.printStackTrace(); + loginInstruction.close(); + } + } + + /** + 用户点击此按钮时, + ①:如果账号不存在或账号存在但是密码错误,则进入密码错误页面。 + ②:如果账号存在且密码正确,则进入主页面(尚未完成)。 + ③:如果勾选了记住账号和密码,则在下一次打开页面时会记住上一次的密码。 + */ + + public void login(){ + + DataBaseController loginInstruction = new DataBaseController(); + ResultSet rs = null; + try{ + + String currentInstruction = "SELECT pwd FROM login WHERE userName=" + "'" + account.getText().trim()+ "'"; + rs = loginInstruction.queryExcecute(currentInstruction); + + + if (rs.next()) { + String rightPassword = rs.getString(1); + if (rightPassword.equals(password.getText())){ + + remember(); + //登入主页面,待定 + System.out.println("登录1"); + + }else{ + new WrongPassword(); + Stage stage = (Stage)createAccount.getScene().getWindow(); + stage.close(); + } + + }else { + new WrongPassword(); + Stage stage = (Stage)createAccount.getScene().getWindow(); + stage.close(); + + } + + }catch (SQLException e){ + e.printStackTrace(); + + }finally { + loginInstruction.close(); + } + } + + + /** + 设置cancel按钮,可以直接点击这里完成窗口的关闭。 + */ + public void cancel(){ + + Stage stage = (Stage)cancel.getScene().getWindow(); + stage.close(); + } + + + + /** + 设置记住账号密码按钮的方法。 + */ + + public void remember(){ + boolean ifclick = remember.isSelected(); + String judgeIfclick = ""; + + if(ifclick){ + judgeIfclick = "true"; + }else { + judgeIfclick = "false"; + } + + try { + FileWriter fw = new FileWriter("src/txtFile/RememberAccount&Password.txt"); + BufferedWriter fis = new BufferedWriter(fw); + + fis.write(account.getText() +"|"+ password.getText() + "|" + judgeIfclick ); + fis.newLine(); + + fis.close(); + fw.close(); + + }catch (Exception e){ + e.printStackTrace(); + } + } + + + /** + 点击注册页面的方法,用户点击以后直接进入注册页面。 + */ + public void createAccount(){ + new CreateAccount(); + Stage stage = (Stage)createAccount.getScene().getWindow(); + stage.close(); + } + + + +} + diff --git a/src/imgzip/Login_SignIn/WrongPassword.java b/src/imgzip/Login_SignIn/WrongPassword.java new file mode 100644 index 0000000..ffe10ad --- /dev/null +++ b/src/imgzip/Login_SignIn/WrongPassword.java @@ -0,0 +1,30 @@ +package imgzip.Login_SignIn; + +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + + +/** + @Author: 肖尧 + @Date: 2019.11.24 + */ + +public class WrongPassword { + public WrongPassword(){ + + try { + + Parent root = FXMLLoader.load(getClass().getResource("/fxml/WrongPassword.fxml")); + Stage primaryStage = new Stage(); + primaryStage.setTitle("Password is wrong!"); + primaryStage.setScene(new Scene(root, 638.0, 400)); + primaryStage.show(); + + }catch (Exception e){ + e.printStackTrace(); + } + + } +} diff --git a/src/imgzip/Login_SignIn/WrongPasswordController.java b/src/imgzip/Login_SignIn/WrongPasswordController.java new file mode 100644 index 0000000..07a4311 --- /dev/null +++ b/src/imgzip/Login_SignIn/WrongPasswordController.java @@ -0,0 +1,61 @@ +package imgzip.Login_SignIn; +import javafx.application.Platform; +import javafx.fxml.FXML; +import javafx.scene.control.Button; +import javafx.stage.Stage; +import sun.rmi.runtime.Log; + +import java.sql.ResultSet; +import java.sql.SQLException; + + +/** + @Author:肖尧 + @Date:2019.11.24 + */ +public class WrongPasswordController { + + @FXML + private Button createAccount; + + @FXML + private Button findPassword; + + @FXML + private Button back; + + + /** + 设置createAccount事件, + 当用户点击该按钮的时候,跳转至用户注册页面 + */ + + public void createAccount(){ + new CreateAccount(); + Stage stage = (Stage)back.getScene().getWindow(); + stage.close(); + } + + + /** + 设置findPassword事件, + 当用户点击该按钮的时候,跳转至用户找回密码页面 + */ + public void findPassword(){ + + } + + + /** + 设置back事件, + 当用户点击该按钮的时候,跳转至登录界面 + */ + public void back(){ + + Stage stage = (Stage)back.getScene().getWindow(); + stage.close(); + new Loginbeginner(); + } + + +} -- Gitee