944,001 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 2150
  • Java RSS
Sep 13th, 2004
0

Help! using separate classes for JFrames

Expand Post »
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
Attached Files
File Type: java DocumentClient.java (2.9 KB, 6 views)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mndeaves is offline Offline
1 posts
since Sep 2004
Sep 18th, 2004
0

Re: Help! using separate classes for JFrames

hmmm...

Quote ...
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());
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
apcxpc is offline Offline
55 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Virgin programmer
Next Thread in Java Forum Timeline: Text breakage when panel is resized





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC