Why does data not save into HashMap?
I am trying to create a log in system in Java using swing and hashmaps. But the data in the hash map does not save?? public class Login implements ActionListener { int enter = 0; static JTextField userName; JPanel mainPanel; static JLabel pass; static boolean correctUser = false; static boolean correctPass = false; static JButton ok; JPasswordField field; JButton newAccount; //Account Frame variables: JFrame accountFrame; JTextField user; JTextField password; JPanel accountPanel; String Password= ""; static String username = ""; boolean enteredPass = false; boolean enteredUserName = false; private static JFrame frame; private static JButton forgotPass; static JButton forgotUser; private HashMap<String, String> users = new HashMap<>(); Map<String, String> forgotUserName = new HashMap<>(); static int tryCount =0; static int count = 0; public Login() throws IOException { System.out.println(users.size()); ok = new JButton("OK"); frame = new JFrame("Login"); userName = new JTextField(20); userName.addActionListener(this); frame.setLocation(500,300); JLabel username = new JLabel("Username:"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); mainPanel = (JPanel) frame.getContentPane(); mainPanel.setBackground(Color.blue); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(username); mainPanel.add(userName); pass = new JLabel("Password:"); field = new JPasswordField(); field.addActionListener(this); mainPanel.add(pass); mainPanel.add(field); newAccount = new JButton("Create a new Account"); newAccount.addActionListener(this); mainPanel.add(newAccount); forgotPass = new JButton("Forgot Password"); forgotPass.addActionListener(this); mainPanel.add(forgotPass); forgotUser = new JButton("Forgot Username"); forgotUser.addActionListener(this); mainPanel.add(forgotUser); frame.pack(); } public void