From 757f615d207cc0be88a95abaf5841caf3c1d104a Mon Sep 17 00:00:00 2001 From: Richard Schmidt Date: Thu, 8 Feb 2024 10:54:40 +0100 Subject: [PATCH] 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 --- src/main/java/LoginGUI.java | 4 ++++ user.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/LoginGUI.java b/src/main/java/LoginGUI.java index 675ffa5..6672019 100644 --- a/src/main/java/LoginGUI.java +++ b/src/main/java/LoginGUI.java @@ -51,6 +51,10 @@ public class LoginGUI extends JFrame implements ActionListener { 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); } }); diff --git a/user.json b/user.json index 5437c96..2dcd5ea 100644 --- a/user.json +++ b/user.json @@ -18,6 +18,6 @@ "userName": "Test User", "password": "Test", "birthday": "01.01.2000", - "stayLoggedIn": true + "stayLoggedIn": false } ] \ No newline at end of file