Hello there. Can anybody help me with this problem.

I am trying to write a program that creates instances of classes that extend JFrame to make my application windows....

This code runs but I can not reference the JTextField shown on the GUI - it seems that there is another instance of it created somehow that is used - to see what I mean run the attatched code, and click connect. The text in the userName text box is not displayed on System.out.....

Any ideas????

Thanks Matthew Deaves


if (e.getSource() == connect){
//THIS DOES NOT THROW THE VALUE OF userName TO loginUser()??????

I don't have Java installed on this computer, so I can't run your program... but the static method you are calling returns a boolean value, so this ActionListener bit should be something like...

Boolean x = loginUser(userName.getText()); (to get said method to run, and to accept the returned boolean value)

if that doesn't work... then try

Boolean x = DocumentClient.loginUser(DocumentClient.userName.getText());