title: how to get a textfield value across different jframes?
body: <p>I'm creating a program that uses several different interacting menus to allow the user to access different parts of the system.  I'm using Netbeans to help with the coding.</p>
  
  <p>At the moment I'm stuck on a task.</p>
  
  <p>When a user logs into the system through a "login" form, the system validates the details, and that user is redirected to either a "user_details" or an "admin_menu" depending on the credentials.  That much works fine. From there, the user is able to access a form that allows them to update their details which are already saved in the database.</p>
  
  <p>The only way I've found to limit the simple user to update their details is to ask them to login again, and from there retrieve their details so that they can be updated. This process is messy, but it works.</p>
  
  <p>with that in mind how do i retrieve whatever was imputed in the textfield "Username" that is located in the jform Login from another jform (User_details), the User_details jform only opens once the login is successful (once that occurs login is discarded and user_details is opened).</p>
  
  <p>by the way i've done a lot of research but cant seem to find an answer to my problem.</p>
  
  <h2>here is part of my log in code :</h2>
  
  <pre><code>String sql = "select * from user where Username =? and password=?";
          try {
              pst = con.prepareStatement(sql);
              pst.setString(1, username.getText());
              pst.setString(2, password.getText());
              rs = pst.executeQuery();
  
              int count = 0;
              while (rs.next()) {
                  count = count + 1;
              }
              if (count == 1) {
                  JOptionPane.showMessageDialog(null, "Access Granted");
                  if ("manager@manage.com".equals(t.getText())) {
                      rs.close();
                      pst.close();
                      close();
                      Admin_menu am = new Admin_menu();
                      am.setVisible(true);
                  } else {
                      rs.close();
                      pst.close();
                      close();
                      User_details M = new User_details();
                      M.setVisible(true);
                  }
              } else {
                  JOptionPane.showMessageDialog(null, "Incorrect Username or Password");
              }
          } catch (Exception ex) {
              JOptionPane.showMessageDialog(null, ex);
  
          } finally {
              try {
                  rs.close();
                  pst.close();
              } catch (Exception ex) {
              }
          }
  </code></pre>
  
  <hr>
  
  <p>how can i make the User_details Jform get what ever was imputed in the textfield username?</p>