Help! using separate classes for JFrames

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2004
Posts: 1
Reputation: mndeaves is an unknown quantity at this point 
Solved Threads: 0
mndeaves mndeaves is offline Offline
Newbie Poster

Help! using separate classes for JFrames

 
0
  #1
Sep 13th, 2004
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, 4 views)
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 55
Reputation: apcxpc is an unknown quantity at this point 
Solved Threads: 0
apcxpc's Avatar
apcxpc apcxpc is offline Offline
Junior Poster in Training

Re: Help! using separate classes for JFrames

 
0
  #2
Sep 18th, 2004
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());
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1997 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC