title: Can't get information from Jframe sub class to normal main class
body: <p>I cant get information which I type in Jtextfield from this class to the main class, I just get null</p>
  
  <pre><code>public class FirstWindow extends JFrame {
  
      private static final long serialVersionUID = 1L;
      private static final String TEXT_FIELD = "text field";
      private static final String TEXT2_FIELD = "text field";
      private static final String PASS_FIELD = "pass field";
  
      private String loginname;
      private String loginlname;
      private String loginpass;
  
      public FirstWindow() {
          super("login");
          setSize(375, 125);
          setResizable(false);
          setLocationRelativeTo(null);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
  
          final JTextField textField = new JTextField(10);// information inputs
          final JTextField textField2 = new JTextField(10);// information inputs
          final JPasswordField passwordField = new JPasswordField(10);// information
                                                                      // inputs
  
          JPanel p = new JPanel(new GridBagLayout());
          JPanel p1 = new JPanel();
          JPanel p2 = new JPanel(new GridBagLayout());
  
          GridBagConstraints gbc = new GridBagConstraints();
          gbc.insets = new Insets(5, 5, 5, 5);
  
          JButton showNamePasswordBtn = new JButton("Ok");
          showNamePasswordBtn.addActionListener(new ActionListener() {
  
              @Override
              public void actionPerformed(ActionEvent arg0) {
                  loginname = textField.getText();// setting first value
                  loginlname = textField2.getText();// setting sc value
                  loginpass = new String(passwordField.getPassword());// setting
                                                                      // th value
                  // System.out.println ("vardas  " +loginname);//information
                  // holders works on this class
                  // System.out.println ("varda  " +loginlname);
                  // System.out.println ("vard  " +loginpass);
                  System.exit(0);
              }
          });
  
          JLabel label = new JLabel("Vartotojo Vardas   ");
          JLabel label2 = new JLabel("Vartotojo Pavarde");
          JLabel label3 = new JLabel("   Vartotojo Slaptazodis");
  
          gbc.gridx = 0;
          gbc.gridy = 0;
          p.add(label, gbc);
          gbc.gridx = 1;
          gbc.gridy = 0;
          p.add(label2, gbc);
          gbc.gridx = 2;
          gbc.gridy = 0;
          p.add(label3, gbc);
  
          p1.add(textField, TEXT_FIELD);
          p1.add(textField2, TEXT2_FIELD);
          p1.add(passwordField, PASS_FIELD);
  
          p2.add(showNamePasswordBtn);
  
          add(p2, BorderLayout.SOUTH);
          add(p1, BorderLayout.CENTER);
          add(p, BorderLayout.NORTH);
      }
  
      public String back() { // tried getting back info
          return loginname;
      }// val1
  
      public String back1() {
          return loginlname;
      }// val2
  
      public String back2() {
          return loginpass;// val3
      }
  }
  </code></pre>
  
  <p>And this is main class where i want get my information</p>
  
  <pre><code>public class GUImain {
  
      public static void main(String[] args) throws Exception {
          FirstWindow fw = new FirstWindow();
          fw.setVisible(true);
          String a, b, c;// creating strings
          a = fw.back();// setting val
          b = fw.back1();// setting val
          c = fw.back2();// setting val
          System.out.println("vardas  " + a);
          System.out.println("pavard  " + b);
          System.out.println("pass " + c);
      }
  }
  </code></pre>
  
  <p>So main problem is everything id working fine expect i cant get any information from Jframe class which is pre most inportant </p>