This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Help with a simple login Gui Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with a simple login Gui" Watch "Help with a simple login Gui" New topic
Author

Help with a simple login Gui

James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282



I get compile errors saying "cannot find symbol txtUsername" Also cannot find txtPassword, username, or password.


Visit my blog! http://jameshambrick.com
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11161
    
  16

txtUsername is declared inside the go() method. if you are not in that method, the variable doesn't exist. Same for the others.

you probably want to declare them as member variables, then set them inside your go() method... something like:



There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
James Hambrick
Ranch Hand

Joined: Sep 04, 2004
Posts: 282

Thanks that worked, I also rename username to strUsername and password to str Password(thinking they were reserved words). And changed txtUsername.setText = ""; to
txtUsername.setText("");

Now it runs yea!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help with a simple login Gui
 
Similar Threads
Help with Chat software
How do you add image in a JLabel?
Checking input in Dialog box before closing
please can someone help me password my Java program!
Problem with default Submit