Question: I have two JFrames `login.java` and `account.java`   

I need to get the `username` from the `login.java` page and put it in a variable in the `account.java` `JFrame`. How can I do this in the Java NetBeans using the Swing?

Answer: 
You can use getter and setter methods...

Set the username in a setter. And using object of login.java use it in account.java through getter...

```
public class login {
    private String username;
    private String password;

    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = this.usernameTextField.getText();
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = this.passwordTextField.getText();
    }
}

```

Using objects of login.java access `getPassword()`, `getUsername()` in account.java. 
you need to pass object of login.java to account.java first...
Well you have very nice way to do it.

Define new Static **Final Objects of that class.**
and Save that value into the Object.

and in other Class u can easily use that objects and as well as that values.
By using 

**CLASSNAME.OBJECT VALUE.**

use that.