From 3a38f7a3235289458e75ed9ba356cec7e4532052 Mon Sep 17 00:00:00 2001 From: Richard Schmidt Date: Wed, 7 Feb 2024 15:12:23 +0100 Subject: [PATCH] Added a checkbox to the login window to stay logged in --- src/main/java/LoginGUI.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/LoginGUI.java b/src/main/java/LoginGUI.java index 5bc3739..696e3a5 100644 --- a/src/main/java/LoginGUI.java +++ b/src/main/java/LoginGUI.java @@ -9,10 +9,11 @@ public class LoginGUI extends JFrame implements ActionListener { private JTextField usernameField; private JPasswordField passwordField; private JButton loginButton; + private JCheckBox stayLoggedInCheckbox; public LoginGUI() { setTitle("Login"); - setSize(300, 150); + setSize(300, 180); setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(null); @@ -32,8 +33,12 @@ public class LoginGUI extends JFrame implements ActionListener { passwordField.setBounds(100, 50, 160, 25); add(passwordField); + stayLoggedInCheckbox = new JCheckBox("Stay Logged In"); + stayLoggedInCheckbox.setBounds(20, 80, 150, 25); + add(stayLoggedInCheckbox); + loginButton = new JButton("Login"); - loginButton.setBounds(100, 90, 100, 25); + loginButton.setBounds(100, 110, 100, 25); loginButton.addActionListener(this); add(loginButton);