title: Iterating through an array list from another class problem
body: <p>This is the class where I store the data:</p>
  <pre><code>package entities;
  
  import java.util.ArrayList;
  
  public class EshopData {
      
      private static ArrayList&lt;User&gt; users = new ArrayList&lt;User&gt;();
      
      public ArrayList&lt;User&gt; getUsers() {
          return users;
      }
  
      public static void setUsers( ArrayList&lt;User&gt; users) {
          EshopData.users = users;
      }
  }
  </code></pre>
  <p>This is my main Frame:</p>
  <pre><code>package ui;
  import java.awt.event.*;
  import java.util.ArrayList;
  
  import javax.swing.*;
  
  import entities.User;
  
  public class Frame extends JFrame{
      
      public static void main(String[] args) {
  
  
          //FRAME
          JFrame frame = new JFrame(&quot;My first Eshop&quot;);
  
          frame.setSize(300, 300);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setResizable(false);
          //frame.setVisible(true);
          frame.setLayout(null);
          
  
          //LABELS
          JLabel l1 = new JLabel(&quot;Username:&quot;);
          JLabel l2 = new JLabel(&quot;Password:&quot;);
  
          l1.setBounds(35, 60, 80, 20);
          l2.setBounds(35, 110, 80, 20);
  
  
          //TEXTFIELDS
          JTextField tf1 = new JTextField();
          JTextField tf2 = new JTextField();
  
          tf1.setBounds(150, 60, 90, 20);
          tf2.setBounds(150, 110, 90, 20);
  
  
          //BUTTONS
          JButton b1 = new JButton(&quot;Register&quot;);
          JButton b2 = new JButton(&quot;Login&quot;);
  
          b1.addActionListener(new ActionListener() {
              
              public void actionPerformed(ActionEvent e){
  
                  RegisterFrame rframe = new RegisterFrame();
                  rframe.setVisible(true);
                  rframe.setSize(600, 600);
              }
          });
  
  
          b2.addActionListener(new ActionListener() {
              
              public void actionPerformed(ActionEvent e){
                  
              }
          });
  
          b1.setBounds(35, 150, 100, 20);
          b2.setBounds(160, 150, 80, 20);
  
          //ADDING TO FRAME
          frame.add(l1);
          frame.add(l2);
          frame.add(tf1);
          frame.add(tf2);
          frame.add(b1);
          frame.add(b2);
  
          frame.setVisible(true);
      }
      
  }
  </code></pre>
  <p>In my main Frame I have a button &quot;Login&quot; (its the 'b2' button) and I want to create an actionListener that will iterate through the array list from above and search for the User.username, if the username exists it will search for the User.password afterwards.
  I am not sure whether I am explaining it correctly or not but any kind of help will be appreciated.</p>
  <p>If you need any other part of the code I am here to provide it for you. Thnak's in advance!</p>