Hi, I am trying to accept user input for a login form. I have JTextField, called textField,. I would like to take user input and use it in another class.
`public String useridGet()
{
return textField.getText();
}
public String userpasswordGet()
{
return passwordField.getText();
}`
I have two ways to return to useridand user passwordfrom the login form.
`Button btnLogin = new JButton("Login");
btnLogin.addActionListener(new ActionListener() {
{
public void actionPerformed(ActionEvent arg0) {
{
loginConnect loginConnectObject = new loginConnect();
loginConnectObject.verifyDetails();
} }
});`
Then, in the login button, I used a method verifyDetails()from the class loginConnectto collect data for comparison with the database.
`public void verifyDetails()
{
loginScreen loginScreenObject = new loginScreen();
String userid = loginScreenObject.useridGet();
String userpassword = loginScreenObject.userpasswordGet();
System.out.println("testing "+userid+userpassword);
}`
In the method, verifyDetails()I tried to create a class object loginScreento access methods getTextthat collect input from the login form.
It is not a seam to work, and I am not sure where I am wrong, any hints. please thanks.
source