I have a JFrame that has a textfield and a button. It should become visible at the start of program and when I click on the button, It should become invisible and send the text of textfield to another class. but It send nothing and when I click on the button the IDE goes to the debug mode.
public class JframeFoo extends JFrame {
    private String username = new String();
    public JframeFoo() {
        // --------------------------------------------------------------
        // Making Frame for login
        final JTextField usernameFiled = new JTextField();
        this.add(usernameFiled);
        JButton signinButton = new JButton();
        // ------------------------------------------------------------
        signinButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent arg0) {
                username = usernameFiled.getText();
                setVisible(false);
                Main.mainpage.setVisible(true);
            }
        });
        // --------------------------------------------------------------------------
    }
    public String getuserName() {
        return this.username;
    }
}
my another class calls Jframe:
System.out.println(JframeFoo.getusername);
 
     
    