Browse Source

Added an if statement in the action listener for the checkbox in LoginGUI so the stayLoggedIn variable gets also changed when the checkbox is unticked

remotes/origin/server
Richard Schmidt 11 months ago
parent
commit
757f615d20
  1. 4
      src/main/java/LoginGUI.java
  2. 2
      user.json

4
src/main/java/LoginGUI.java

@ -51,6 +51,10 @@ public class LoginGUI extends JFrame implements ActionListener {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
boolean stayLoggedIn = stayLoggedInCheckbox.isSelected(); boolean stayLoggedIn = stayLoggedInCheckbox.isSelected();
String username = usernameField.getText(); String username = usernameField.getText();
// Set stayLoggedIn to false if the checkbox is unchecked
if (!stayLoggedInCheckbox.isSelected()) {
stayLoggedIn = false;
}
updateStayLoggedIn(username, stayLoggedIn); updateStayLoggedIn(username, stayLoggedIn);
} }
}); });

2
user.json

@ -18,6 +18,6 @@
"userName": "Test User", "userName": "Test User",
"password": "Test", "password": "Test",
"birthday": "01.01.2000", "birthday": "01.01.2000",
"stayLoggedIn": true
"stayLoggedIn": false
} }
] ]
Loading…
Cancel
Save