954,518 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help! using separate classes for JFrames

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

Attachments DocumentClient.java (2.92KB)
mndeaves
Newbie Poster
1 post since Sep 2004
Reputation Points: 10
Solved Threads: 0
 

hmmm...

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

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());

apcxpc
Junior Poster in Training
55 posts since Sep 2004
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You