Browse Source

refactoring: stayLoggedInCheckbox listener in LoginGUI

main
Richard Schmidt 11 months ago
parent
commit
f24fb69051
  1. 17
      src/main/java/LoginGUI.java
  2. 3
      user.json

17
src/main/java/LoginGUI.java

@ -75,17 +75,14 @@ public class LoginGUI extends JFrame implements ActionListener {
passwordField.addKeyListener(new EnterKeyListener());
stayLoggedInCheckbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean stayLoggedIn = stayLoggedInCheckbox.isSelected();
String username = usernameField.getText();
// Set stayLoggedIn to false if the checkbox is unchecked
if (!stayLoggedInCheckbox.isSelected()) {
stayLoggedIn = false;
}
updateStayLoggedIn(username, stayLoggedIn);
stayLoggedInCheckbox.addActionListener(e -> {
boolean stayLoggedIn = stayLoggedInCheckbox.isSelected();
String username = usernameField.getText();
// Set stayLoggedIn to false if the checkbox is unchecked
if (!stayLoggedInCheckbox.isSelected()) {
stayLoggedIn = false;
}
updateStayLoggedIn(username, stayLoggedIn);
});
}

3
user.json

@ -1,2 +1 @@
[
]
[]
Loading…
Cancel
Save