From 1458dbf45fdc18c3a7a58700c1c8b96ec00f676e Mon Sep 17 00:00:00 2001 From: 50582 <505822174@qq.com> Date: Sun, 15 Dec 2019 11:49:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9B=BE=E7=89=87=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=92=8C=E4=BB=A3=E7=A0=81=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fxml/ChangePassword.fxml | 2 +- src/fxml/ChangePasswordSuccessfully.fxml | 2 +- src/fxml/CreateAccount.fxml | 2 +- src/fxml/CreateSuccessfully.fxml | 2 +- src/fxml/FindPassword.fxml | 2 +- src/imgzip/Login_SignIn/Login.java | 6 ++-- src/imgzip/Login_SignIn/LoginBeginner.java | 39 +++++++++++++--------- 7 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/fxml/ChangePassword.fxml b/src/fxml/ChangePassword.fxml index 5e15465..0413fe6 100644 --- a/src/fxml/ChangePassword.fxml +++ b/src/fxml/ChangePassword.fxml @@ -17,7 +17,7 @@ - + diff --git a/src/fxml/ChangePasswordSuccessfully.fxml b/src/fxml/ChangePasswordSuccessfully.fxml index 832557c..358280a 100644 --- a/src/fxml/ChangePasswordSuccessfully.fxml +++ b/src/fxml/ChangePasswordSuccessfully.fxml @@ -15,7 +15,7 @@ - + diff --git a/src/fxml/CreateAccount.fxml b/src/fxml/CreateAccount.fxml index a458fcb..d6d4c44 100644 --- a/src/fxml/CreateAccount.fxml +++ b/src/fxml/CreateAccount.fxml @@ -18,7 +18,7 @@ - + diff --git a/src/fxml/CreateSuccessfully.fxml b/src/fxml/CreateSuccessfully.fxml index 31d24c3..3553415 100644 --- a/src/fxml/CreateSuccessfully.fxml +++ b/src/fxml/CreateSuccessfully.fxml @@ -15,7 +15,7 @@ - + diff --git a/src/fxml/FindPassword.fxml b/src/fxml/FindPassword.fxml index 89d3394..009334a 100644 --- a/src/fxml/FindPassword.fxml +++ b/src/fxml/FindPassword.fxml @@ -17,7 +17,7 @@ - + diff --git a/src/imgzip/Login_SignIn/Login.java b/src/imgzip/Login_SignIn/Login.java index 67a69d7..856303b 100644 --- a/src/imgzip/Login_SignIn/Login.java +++ b/src/imgzip/Login_SignIn/Login.java @@ -46,9 +46,9 @@ public class Login extends Application { try { File file = new File("src/txtFile/RememberAccount&Password.txt"); -// if(!file.exists()){ -// file.createNewFile(); -// } + if(!file.exists()){ + file.createNewFile(); + } FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); diff --git a/src/imgzip/Login_SignIn/LoginBeginner.java b/src/imgzip/Login_SignIn/LoginBeginner.java index 49a64b8..df575e6 100644 --- a/src/imgzip/Login_SignIn/LoginBeginner.java +++ b/src/imgzip/Login_SignIn/LoginBeginner.java @@ -10,6 +10,7 @@ import javafx.scene.control.TextField; import javafx.stage.Stage; import java.io.BufferedReader; +import java.io.File; import java.io.FileReader; @@ -38,7 +39,8 @@ public class LoginBeginner { PasswordField password = (PasswordField)root.lookup("#password"); CheckBox remember = (CheckBox)root.lookup("#remember"); Button logIn = (Button)root.lookup("#Login"); - + Label passwordWrong = (Label)root.lookup("#passwordWrong"); + passwordWrong.setVisible(false); /** 在页面开启之前检查上一次登录时是否记住了密码, @@ -46,34 +48,41 @@ public class LoginBeginner { */ try { - FileReader fr = new FileReader("src/txtFile/RememberAccount&Password.txt"); + File file = new File("src/txtFile/RememberAccount&Password.txt"); + if(!file.exists()){ + file.createNewFile(); + } + + File file1 = new File("src/txtFile/RememberAccount&Password.txt"); + FileReader fr = new FileReader(file1); BufferedReader br = new BufferedReader(fr); String line = ""; line = br.readLine(); + if(file1.length() != 0){ - String[] judge = line.split("\\|"); - String truejudge = "true"; - int accountIndex = 0; - int passwordIndex = 1; - int judgeIndex = 2; + 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]); + if(judge[judgeIndex].equals(truejudge) ){ + account.setText(judge[accountIndex]); + password.appendText(judge[passwordIndex]); - remember.setSelected(true); - logIn.setDisable(false); + remember.setSelected(true); + logIn.setDisable(false); + } + br.close(); + fr.close(); } - br.close(); - fr.close(); }catch (Exception e){ e.printStackTrace(); - } primaryStage.setTitle("XXX login"); -- Gitee From 8f1fe60f3ae06e27b233b2037ea0d8db1c0df444 Mon Sep 17 00:00:00 2001 From: 50582 <505822174@qq.com> Date: Sun, 15 Dec 2019 12:05:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86ID=E5=92=8C?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fxml/ChangePassword.fxml | 2 +- src/fxml/ChangePasswordSuccessfully.fxml | 2 +- src/fxml/CreateAccount.fxml | 12 ++++++------ src/fxml/CreateSuccessfully.fxml | 2 +- src/fxml/FindPassword.fxml | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/fxml/ChangePassword.fxml b/src/fxml/ChangePassword.fxml index 0413fe6..5e15465 100644 --- a/src/fxml/ChangePassword.fxml +++ b/src/fxml/ChangePassword.fxml @@ -17,7 +17,7 @@ - + diff --git a/src/fxml/ChangePasswordSuccessfully.fxml b/src/fxml/ChangePasswordSuccessfully.fxml index 358280a..9f8ac72 100644 --- a/src/fxml/ChangePasswordSuccessfully.fxml +++ b/src/fxml/ChangePasswordSuccessfully.fxml @@ -15,7 +15,7 @@ - + diff --git a/src/fxml/CreateAccount.fxml b/src/fxml/CreateAccount.fxml index d6d4c44..f903094 100644 --- a/src/fxml/CreateAccount.fxml +++ b/src/fxml/CreateAccount.fxml @@ -18,7 +18,7 @@ - + @@ -65,7 +65,7 @@ - + @@ -85,7 +85,7 @@ - + @@ -94,7 +94,7 @@ - + @@ -103,7 +103,7 @@ - + @@ -120,7 +120,7 @@ diff --git a/src/fxml/CreateSuccessfully.fxml b/src/fxml/CreateSuccessfully.fxml index 3553415..31d24c3 100644 --- a/src/fxml/CreateSuccessfully.fxml +++ b/src/fxml/CreateSuccessfully.fxml @@ -15,7 +15,7 @@ - + diff --git a/src/fxml/FindPassword.fxml b/src/fxml/FindPassword.fxml index 009334a..4a32baa 100644 --- a/src/fxml/FindPassword.fxml +++ b/src/fxml/FindPassword.fxml @@ -15,9 +15,9 @@ - + - + -- Gitee