I am using Java Swing in Netbeans and MySQL. I am designing a very simple user login application. I have two jFrames. One is for the login page that asks user to enter their ID and Password. Once the user account is searched and verified in database, the other jFrame simply displays the user information, such as name, address, and email address that is associated with the account.
So I have 2 jFrame forms (login and profile) and one class that has all the information about the user (String name, String address, String email).
My question is how does the profile jFrame display what was entered in login jFrame? For example, I'd like to say "Hi, 'username'".
// profile jFrame constructor
public profile() {
Login login = new Login();
JOptionPane.showMessageDialog(null, "Hi" + login.getName());
// Display any info associated with login.getName() in database
}
// inside login jFrame class
public String getUsername() {
String user = jTextName.getText();
return user;
}
First, login.getName() only displays "Frame0". And I think my design is not how usually it's done for such applications. Please help.